getResult example

$export = $this->container->get('modules')->Export();

        $export->sSYSTEM = $this->container->get('modules')->System();

        $this->sSmarty = $this->container->get(Enlight_Template_Manager::class);

        // Prevent notices to clutter generated files         $this->registerErrorHandler($output);

        $productFeedRepository = $this->container->get(ModelManager::class)->getRepository(ProductFeed::class);
        if (empty($feedId)) {
            $activeFeeds = $productFeedRepository->getActiveListQuery()->getResult();

            /** @var ProductFeed $feedModel */
            foreach ($activeFeeds as $feedModel) {
                if ($feedModel->getInterval() === 0) {
                    continue;
                }
                $this->generateFeed($export$feedModel);
            }
        } else {
            /** @var ProductFeed|null $productFeed */
            $productFeed = $productFeedRepository->find((int) $feedId);
            
return;
        }

        $request->request->set('parentId', $product->getParentId());
        $reviews = $this->productReviewLoader->load($request$context);
        $reviews->setParentId($product->getParentId() ?? $product->getId());

        $page->setReviews($reviews);

        $crossSellings = $this->crossSellingRoute->load($product->getId()new Request()$contextnew Criteria());

        $page->setCrossSellings($crossSellings->getResult());
    }
}
$bingo[$keys[$k]] = $binds[trim($values[$k], ':')];
        }

        // Querying existing data         $builder = $this->db->table($table);

        foreach ($bingo as $k => $v) {
            $builder->where($k$v);
        }

        $q = $builder->get()->getResult();

        // Delete entries if we find them         if ($q !== []) {
            $delete = $this->db->table($table);

            foreach ($bingo as $k => $v) {
                $delete->where($k$v);
            }

            $delete->delete();
        }

        
if (!$handledStamps) {
            throw new LogicException(sprintf('Message of type "%s" was handled zero times. Exactly one handler is expected when using "%s::%s()".', get_debug_type($envelope->getMessage())static::class, __FUNCTION__));
        }

        if (\count($handledStamps) > 1) {
            $handlers = implode(', ', array_map(fn (HandledStamp $stamp): string => sprintf('"%s"', $stamp->getHandlerName())$handledStamps));

            throw new LogicException(sprintf('Message of type "%s" was handled multiple times. Only one handler is expected when using "%s::%s()", got %d: %s.', get_debug_type($envelope->getMessage())static::class, __FUNCTION__, \count($handledStamps)$handlers));
        }

        return $handledStamps[0]->getResult();
    }
}

    private function removeDeletedThemes()
    {
        $themes = $this->repository->createQueryBuilder('templates');
        $themes->where('templates.version = 3')
            ->andWhere('templates.pluginId IS NULL');

        $themes = $themes->getQuery()->getResult(AbstractQuery::HYDRATE_OBJECT);

        /** @var Template $theme */
        foreach ($themes as $theme) {
            $directory = $this->pathResolver->getDirectory($theme);
            if (!file_exists($directory)) {
                $this->entityManager->remove($theme);
            }
        }

        $this->entityManager->flush();
    }

    
$domains = $provider->getDomains();
        }

        $providerTranslations = $provider->read($domains$locales);

        if ($force) {
            foreach ($providerTranslations->getCatalogues() as $catalogue) {
                $operation = new TargetOperation(new MessageCatalogue($catalogue->getLocale())$catalogue);
                if ($intlIcu) {
                    $operation->moveMessagesToIntlDomainsIfPossible();
                }
                $this->writer->write($operation->getResult()$format$writeOptions);
            }

            $io->success(sprintf('Local translations has been updated from "%s" (for "%s" locale(s), and "%s" domain(s)).', parse_url($provider, \PHP_URL_SCHEME)implode(', ', $locales)implode(', ', $domains)));

            return 0;
        }

        $localTranslations = $this->readLocalTranslations($locales$domains$this->transPaths);

        // Append pulled translations to local ones.         $localTranslations->addBag($providerTranslations->diff($localTranslations));

        
$this->restrictSortings($request$slot);
            $this->addDefaultSorting($request$slot);
        }

        $navigationId = $this->getNavigationId($request$context);

        $criteria = new Criteria();
        $criteria->setTitle('cms::product-listing');

        $listing = $this->listingRoute
            ->load($navigationId$request$context$criteria)
            ->getResult();

        $data->setListing($listing);
    }

    private function getNavigationId(Request $request, SalesChannelContext $salesChannelContext): string
    {
        if ($navigationId = $request->get('navigationId')) {
            return $navigationId;
        }

        $params = $request->attributes->get('_route_params');

        
#[Route(path: '/widgets/cms/navigation/{navigationId}/filter', name: 'frontend.cms.navigation.filter', defaults: ['XmlHttpRequest' => true, '_routeScope' => ['storefront'], '_httpCache' => true], methods: ['GET', 'POST'])]     public function filter(string $navigationId, Request $request, SalesChannelContext $context): Response
    {
        // Allows to fetch only aggregations over the gateway.         $request->request->set('only-aggregations', true);

        // Allows to convert all post-filters to filters. This leads to the fact that only aggregation values are returned, which are combinable with the previous applied filters.         $request->request->set('reduce-aggregations', true);

        $listing = $this->listingRoute
            ->load($navigationId$request$contextnew Criteria())
            ->getResult();

        $mapped = [];
        foreach ($listing->getAggregations() as $aggregation) {
            $mapped[$aggregation->getName()] = $aggregation;
        }

        $response = new JsonResponse($mapped);

        $response->headers->set('x-robots-tag', 'noindex');

        return $response;
    }
private function explodePriceVariation($variation)
    {
        if (empty($variation['options'])) {
            return $variation;
        }

        $optionIds = explode('|', trim($variation['options'], '|'));

        $options = $this->get('models')
            ->getRepository(Article::class)
            ->getAllConfiguratorOptionsIndexedByIdQuery(['options.id' => $optionIds])
            ->getResult();

        $variation['option_names'] = [];

        foreach ($options as $option) {
            $variation['option_names'][] = [
                'group' => $option->getGroup()->getName(),
                'option' => $option->getName(),
            ];
        }

        unset($variation['options']);

        

            }
        );

        $suggestResultEventFired = false;
        $this->eventDispatcher->addListener(
            ProductEvents::PRODUCT_SUGGEST_RESULT,
            static function DProductSuggestResultEvent $event) use (&$suggestResultEventFired): void {
                $suggestResultEventFired = true;

                static::assertTrue(
                    $event->getResult()->getCriteria()->hasState(Criteria::STATE_ELASTICSEARCH_AWARE),
                    'Criteria should be Elasticsearch aware'
                );
            }
        );

        $salesChannelContext = $this->createMock(SalesChannelContext::class);
        $salesChannelContext->method('getContext')->willReturn(Context::createDefaultContext());

        $result = $this->getProductSuggestRoute()->load(
            $request,
            $salesChannelContext,
            
protected function doFind(bool $singleton$id = null)
    {
        $builder = $this->builder();

        if ($this->tempUseSoftDeletes) {
            $builder->where($this->table . '.' . $this->deletedField, null);
        }

        if (is_array($id)) {
            $row = $builder->whereIn($this->table . '.' . $this->primaryKey, $id)
                ->get()
                ->getResult($this->tempReturnType);
        } elseif ($singleton) {
            $row = $builder->where($this->table . '.' . $this->primaryKey, $id)
                ->get()
                ->getFirstRow($this->tempReturnType);
        } else {
            $row = $builder->get()->getResult($this->tempReturnType);
        }

        return $row;
    }

    


        if ($deleteLog) {
            $this->filesystem->delete($invalidLogFilePath);
            $this->filesystem->delete($log->getFile()->getPath());
        }
    }

    private function printResults(ImportExportLogEntity $log, SymfonyStyle $io): void
    {
        $importExport = $this->importExportFactory->create($log->getId());
        $results = $importExport->getLogEntity()->getResult();

        if (empty($results)) {
            return;
        }

        $rows = [];
        foreach ($results as $entity => $values) {
            ksort($values);
            $rows[] = array_merge(['entity' => $entity]$values);
        }
        $headers = array_keys(reset($rows));

        

        } else {
            $parameterType = class_exists(ArrayParameterType::class) ? ArrayParameterType::STRING : Connection::PARAM_STR_ARRAY;
        }
        if (!$values) {
            return [];
        }

        return $qb->andWhere($where)
                  ->getQuery()
                  ->setParameter($parameter$values$parameterType)
                  ->getResult();
    }
}
$request = new Request();

        $request->query->set('search', ['product']);

        $context = $this->getContainer()->get(SalesChannelContextFactory::class)
            ->create(Uuid::randomHex(), TestDefaults::SALES_CHANNEL);

        $listing = $this->getContainer()
            ->get(ProductListingRoute::class)
            ->load($this->categoryId, $request$contextnew Criteria())
            ->getResult();

        static::assertSame(5, $listing->getTotal());
        static::assertFalse($listing->has($this->testData->getId('product1')));
        static::assertFalse($listing->has($this->testData->getId('product2')));

        // product 1 has all available variants         static::assertTrue($listing->has($this->testData->getId('product1-red')));
        static::assertTrue($listing->has($this->testData->getId('product1-green')));
        static::assertTrue($listing->has($this->testData->getId('product1-blue')));

        // product 2 has all available variants
$categoryId = $product['categories'][0]['id'];

        $this->getContainer()->get('product.repository')
            ->create([$product], Context::createDefaultContext());

        $context = $this->getContainer()->get(SalesChannelContextFactory::class)
            ->create(Uuid::randomHex(), TestDefaults::SALES_CHANNEL);

        $listing = $this->getContainer()
            ->get(ProductListingRoute::class)
            ->load($categoryId$request$contextnew Criteria())
            ->getResult();

        $aggregation = $listing->getAggregations()->get($expected['aggregation']);

        if ($expected['instanceOf'] === null) {
            static::assertNull($aggregation);
        } else {
            static::assertInstanceOf($expected['instanceOf']$aggregation);
        }

        if ($expected['aggregation'] === 'properties' && isset($expected['propertyWhitelistIds'])) {
            static::assertInstanceOf(EntityResult::class$aggregation);
            
Home | Imprint | This part of the site doesn't use cookies.