getPluginModel example

public function preDispatch()
    {
        parent::preDispatch();

        $this->pluginManager = $this->get(\Shopware\Bundle\PluginInstallerBundle\Service\InstallerService::class);
    }

    public function installPluginAction()
    {
        @set_time_limit(300);

        $plugin = $this->getPluginModel($this->Request()->getParam('technicalName'));

        if (!$plugin instanceof Plugin) {
            $this->pluginManager->refreshPluginList();
            $plugin = $this->getPluginModel($this->Request()->getParam('technicalName'));
        }

        if (!$plugin instanceof Plugin) {
            $this->View()->assign([
                'success' => false,
                'message' => sprintf('Plugin not found %s', $this->Request()->getParam('technicalName')),
            ]);

            

        if (!$plugin->isUpdateAvailable()) {
            $this->io->text(sprintf('No update available for plugin %s', $plugin->getLabel()));

            return;
        }

        $this->io->comment(sprintf('Download plugin update package %s', $plugin->getLabel()));

        $request = new DownloadRequest($plugin->getTechnicalName()$version$domain, null);

        $model = $this->getPluginModel($plugin->getTechnicalName());
        if ($plugin->isActive()) {
            $this->container->get(InstallerService::class)->deactivatePlugin($model);
        }

        $this->container->get('shopware_plugininstaller.plugin_download_service')
            ->download($request);
    }

    /** * @param string $version * @param string $domain * * @throws Exception */
Home | Imprint | This part of the site doesn't use cookies.