getStoreListing example

/** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $shopwareVersion = $this->container->getParameter('shopware.release.version');
        if (!\is_string($shopwareVersion)) {
            throw new RuntimeException('Parameter shopware.release.version has to be an string');
        }

        $context = new ListingRequest('', $shopwareVersion, 0, 1000, [['property' => 'dummy', 'value' => 1]][]);
        $listing = $this->container->get('shopware_plugininstaller.plugin_service_view')->getStoreListing($context);

        $result = [];
        foreach ($listing->getPlugins() as $plugin) {
            $result[] = [
                'id' => $plugin->getId(),
                'technicalName' => $plugin->getTechnicalName(),
                'label' => $plugin->getLabel(),
                'installed' => ($plugin->getInstallationDate() !== null),
                'version' => $plugin->getVersion(),
                'updateAvailable' => $plugin->isUpdateAvailable(),
            ];
        }
$context = new ListingRequest(
            $this->getLocale(),
            $this->getVersion(),
            (int) $this->Request()->getParam('start', 0),
            (int) $this->Request()->getParam('limit', 30),
            $filter,
            $sort
        );

        try {
            $listingResult = $this->get('shopware_plugininstaller.plugin_service_view')->getStoreListing($context);
        } catch (Exception $e) {
            $this->handleException($e);

            return;
        }

        $this->View()->assign([
            'success' => true,
            'data' => array_values($listingResult->getPlugins()),
            'total' => $listingResult->getTotalCount(),
        ]);
    }
Home | Imprint | This part of the site doesn't use cookies.