/**
  * @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()]);
         }
     }
 }
Esempio n. 2
0
 /**
  * @param PluginStruct[] $plugins
  * @param BaseRequest $context
  * @return PluginStruct[]
  */
 private function getAdditionallyStoreData($plugins, BaseRequest $context)
 {
     $names = array_keys($plugins);
     $storeContext = new PluginsByTechnicalNameRequest($context->getLocale(), $context->getShopwareVersion(), $names);
     $store = $this->storePluginService->getPlugins($storeContext);
     $merged = [];
     foreach ($plugins as $plugin) {
         $key = strtolower($plugin->getTechnicalName());
         if (!array_key_exists($key, $store)) {
             $merged[$key] = $plugin;
             continue;
         }
         $storePlugin = $store[$key];
         $this->hydrator->assignStorePluginStruct($plugin, $storePlugin);
         $merged[$key] = $plugin;
     }
     return $merged;
 }