synchronize example

$this->writeBacklog($backlogs);
    }

    /** * {@inheritdoc} */
    public function process(ShopIndex $shopIndex$backlogs)
    {
        foreach ($this->synchronizers as $synchronizer) {
            if ($synchronizer->supports() === $shopIndex->getType()) {
                $synchronizer->synchronize($shopIndex$backlogs);
            }
        }
    }

    /** * @return SynchronizerInterface[] */
    private function collectSynchronizer(): array
    {
        $collection = new ArrayCollection();
        $this->eventManager->collect(
            
if (is_dir(SW_PATH . '/recovery/install')) {
            /** @var \Shopware\Recovery\Common\SystemLocker $systemLocker */
            $systemLocker = $this->container->get('system.locker');
            $systemLocker();
        }
    }

    private function synchronizeThemes()
    {
        /** @var \Shopware\Components\Theme\Installer $themeService */
        $themeService = $this->container->get('shopware.theme_installer');
        $themeService->synchronize();
    }
}
->via('GET', 'POST')->name('cleanup');

$app->map('/clearCache', function D) use ($container) {
    $container->get('controller.cleanup')->deleteOutdatedFolders();
})->via('GET', 'POST')->name('clearCache');

$app->map('/done', function D) use ($app$container) {
    $container->get('shopware.update.chmod')->changePermissions();

    /** @var Installer $themeService */
    $themeService = $container->get('shopware.theme_installer');
    $themeService->synchronize();

    if (is_dir(SW_PATH . '/recovery/install')) {
        /** @var SystemLocker $systemLocker */
        $systemLocker = $container->get('system.locker');
        $systemLocker();
    }

    $changedTheme = (bool) !empty($_SESSION['changedTheme']) ?: false;
    $app->view()->set('changedTheme', $changedTheme);

    if (UPDATE_IS_MANUAL) {
        
// Before the inheritance can be built, the plugin themes have to be initialized.         $pluginThemes = $this->synchronizePluginThemes();

        $themes = array_merge($themes$pluginThemes);

        // Builds the theme inheritance         $this->setParents($themes);

        /** @var Theme $theme */
        foreach ($themes as $theme) {
            $this->configurator->synchronize($theme);
        }
    }

    /** * Helper function which iterates the engine\Shopware\Themes directory * and registers all stored themes within the directory as \Shopware\Models\Shop\Template. * * @throws \Doctrine\ORM\OptimisticLockException * @throws \Doctrine\ORM\ORMInvalidArgumentException * * @return Theme[] */
class PluginManager extends Shopware_Controllers_Backend_ExtJs
{
    public const FALLBACK_LOCALE = 'en_GB';

    /** * @return void */
    public function preDispatch()
    {
        if (strtolower($this->Request()->getActionName()) === 'index' && $this->checkStoreApi()) {
            $this->getCategoryService()->synchronize();
        }
        parent::preDispatch();
    }

    /** * @return void */
    public function metaDownloadAction()
    {
        try {
            $request = new MetaRequest(
                

    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $arguments = $input->getArguments();

        $themeInstaller = $this->container->get(Installer::class);
        $themeInstaller->synchronize();

        if ($this->getRepository()->findOneBy(['template' => $arguments['template']])) {
            $output->writeln('A theme with that name already exists');

            return 1;
        }

        if (!\is_string($arguments['parent'])) {
            throw new RuntimeException('Invalid argument "parent" given.');
        }

        
->setDescription('Synchronizes theme configurations with the database')
        ;
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var \Shopware\Components\Theme\Installer $themeService */
        $themeService = $this->container->get(\Shopware\Components\Theme\Installer::class);
        $themeService->synchronize();

        $output->writeln('Themes synchronized');

        return 0;
    }
}
/** * @param string $file * * @throws Exception */
    private function installForm(Plugin $plugin$file)
    {
        $xmlConfigReader = new XmlConfigReader();
        $config = $xmlConfigReader->read($file);

        $formSynchronizer = new FormSynchronizer($this->em);
        $formSynchronizer->synchronize($plugin$config);
    }

    /** * @param string $file * * @throws InvalidArgumentException */
    private function installMenu(Plugin $plugin$file)
    {
        $menuReader = new XmlMenuReader();
        $menu = $menuReader->read($file);

        
 {
        $this->modelManager = $modelManager;
        $this->provider = $provider;
        $this->menuSynchronizer = $menuSynchronizer;
        $this->aclSynchronizer = $aclSynchronizer;
    }

    public function sync(bool $destructive = false): array
    {
        $types = $this->provider->getTypes();

        $this->menuSynchronizer->synchronize(self::getMenuEntries($types));
        $this->createTables($types$destructive);
        $this->aclSynchronizer->update(array_map(static function DType $type) {
            return strtolower($type->getControllerName());
        }$types));

        return $types;
    }

    public function setTypeProvider(TypeProvider $typeProvider): void
    {
        $this->provider = $typeProvider;
    }
->setName('sw:theme:initialize')
            ->setDescription('Initializes themes. Enables responsive theme for the default shop.');
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var Installer $themeInstaller */
        $themeInstaller = $this->container->get(\Shopware\Components\Theme\Installer::class);
        $themeInstaller->synchronize();

        $this->conn = $this->container->get(\Doctrine\DBAL\Connection::class);

        $templateId = $this->getResponsiveTemplateId();
        $this->updateDefaultTemplateId($templateId);

        $output->writeln('Themes initialized');

        return 0;
    }

    
$this->View()->assign('success', true);
    }

    /** * Override of the application controller * to trigger the theme and template registration when the * list should be displayed. */
    public function listAction()
    {
        $this->container->get(Installer::class)->synchronize();

        parent::listAction();
    }

    /** * Used for the configuration window. * Returns all configuration sets for the passed * template id. * * @return void */
    

    private $themeInstaller;

    public function __construct(PDO $conn, ThemeInstaller $themeInstaller)
    {
        $this->themeInstaller = $themeInstaller;
        $this->conn = $conn;
    }

    public function activateResponsiveTheme()
    {
        $this->themeInstaller->synchronize();

        $templateId = $this->getResponsiveTemplateId();

        $this->updateDefaultTemplateId($templateId);
    }

    /** * @return int */
    private function getResponsiveTemplateId()
    {
        
Home | Imprint | This part of the site doesn't use cookies.