I spent half a day to understand and I don't know what to do. I have an XML file with 146 565 records of name and class with import XML
public function parse() {
$start = microtime(true);
$q = 1;
while ($this->reader->read() && $this->reader->name !== 'licenses');
while ($this->reader->localName === 'licenses') {
$node = simplexml_import_dom($this->doc->importNode($this->reader->expand(), true));
$inn = (string) $node->inn;
$name = (string) $node->name;
$this->service->create($name, $inn);
}
echo 'Time script: ' . round(microtime(true) - $start, 4) . ' sec.';
}
when i use echo $name instead of $this->service->create($name, $inn); it works fine. I get 146 565 names on my screen. But when I add it in MySql with my service, the script doesn't stop. When I to a test file with 1000 lines it imported into the database well.
MariaDB [dbbase]> SELECT COUNT(1) FROM names_table;
+----------+
| COUNT(1) |
+----------+
| 248778 |
My service
public function create(string $name, string $inn): bool {
try {
$this->sth->execute([
':uuid' => Uuid::uuid4(),
':name' => $name,
':inn' => $inn
]);
return true;
} catch (RuntimeException $e) {
die($e->getMessage());
}
}
How to solve it? I understand than it is something wrong with service but i don't know what to do. I try without return true and with it - script doesn't stop.
P.S. Added id (primary, auto_increment) instead of uuid - result the same.