/** * @throws \Doctrine\DBAL\DBALException */ public function synchronize() { $categories = $this->pluginService->getCategories(); $this->connection->exec("DELETE FROM s_core_plugin_categories"); $statement = $this->connection->prepare("INSERT INTO s_core_plugin_categories (id, locale, parent_id, name)\n VALUES (:id, :locale, :parent_id, :name)"); $pseudo = $this->getPseudoCategories(); foreach ($pseudo as $category) { $statement->execute($category); } foreach ($categories as $category) { foreach ($category->getName() as $locale => $name) { $statement->execute([':id' => $category->getId(), ':name' => $name, ':locale' => $locale, ':parent_id' => $category->getParentId()]); } } }