getShopsWithThemes example

->setName('sw:theme:dump:configuration')
            ->setDescription('Dumps the theme configuration into json files')
        ;
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $repository = $this->container->get(\Shopware\Components\Model\ModelManager::class)->getRepository(Shop::class);
        $shops = $repository->getShopsWithThemes()->getResult();
        $compiler = $this->container->get('theme_compiler');
        $rootDir = $this->container->getParameter('shopware.app.rootDir');

        if (!\is_string($rootDir)) {
            throw new RuntimeException('Parameter shopware.app.rootDir has to be an string');
        }

        /** @var Shop $shop */
        foreach ($shops as $shop) {
            $configuration = $compiler->getThemeConfiguration($shop);
            $file = $this->dumpConfiguration($shop$configuration);
            
$shopId = $this->Request()->getParam('shopId');
        $filter = $this->Request()->getParam('filter', []);
        if ($shopId) {
            $filter[] = [
                'property' => 'shop.id',
                'value' => $shopId,
                'operator' => null,
                'expression' => null,
            ];
        }

        $query = $repository->getShopsWithThemes(
            $filter,
            $this->Request()->getParam('sort', []),
            $this->Request()->getParam('start'),
            $this->Request()->getParam('limit')
        );

        // Get total result of the query         $total = $this->get('models')->getQueryCount($query);

        // Select all shop as array         $data = $query->getArrayResult();

        


    /** * Warms up the cache for a theme shop */
    public function themeCacheWarmUpAction()
    {
        $shopId = $this->Request()->get('shopId');

        $repository = $this->get(ModelManager::class)->getRepository(Shop::class);

        $query = $repository->getShopsWithThemes(['shop.id' => $shopId]);

        /** @var Shop|null $shop */
        $shop = $query->getResult(
            AbstractQuery::HYDRATE_OBJECT
        )[0];

        if (!$shop) {
            $this->View()->assign([
                'success' => false,
            ]);

            
/** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $repository = $this->container->get(ModelManager::class)->getRepository(Shop::class);

        $shopIds = $input->getOption('shopId');
        $current = (bool) $input->getOption('current');

        $shopsWithThemes = $repository->getShopsWithThemes()->getResult(AbstractQuery::HYDRATE_OBJECT);

        if (!empty($shopIds)) {
            $shopsWithThemes = array_filter($shopsWithThemesfunction DShop $shop) use ($shopIds) {
                return \in_array($shop->getId()$shopIds);
            });
        }

        if (empty($shopsWithThemes)) {
            $output->writeln('No theme shops found');

            return 0;
        }
Home | Imprint | This part of the site doesn't use cookies.