@param \Orm\Zed\Brand\Persistence\FosBrandQuery $fosBrandQuery
@param \Generated\Shared\Transfer\PaginationTransfer|null $paginationTransfer

@return \Orm\Zed\Brand\Persistence\FosBrandQuery
558978
protected function applyPagination(FosBrandQuery $fosBrandQuery, ?PaginationTransfer $paginationTransfer = null): FosBrandQuery
    {
        if (empty($paginationTransfer)) {
            return $fosBrandQuery;
        }

        $page = $paginationTransfer
            ->requirePage()
            ->getPage();

        $maxPerPage = $paginationTransfer
            ->requireMaxPerPage()
            ->getMaxPerPage();

        $paginationModel = $fosBrandQuery->paginate($page, $maxPerPage);

        $paginationTransfer->setNbResults($paginationModel->getNbResults());
        $paginationTransfer->setFirstIndex($paginationModel->getFirstIndex());
        $paginationTransfer->setLastIndex($paginationModel->getLastIndex());
        $paginationTransfer->setFirstPage($paginationModel->getFirstPage());
        $paginationTransfer->setLastPage($paginationModel->getLastPage());
        $paginationTransfer->setNextPage($paginationModel->getNextPage());
        $paginationTransfer->setPreviousPage($paginationModel->getPreviousPage());

        return $paginationModel->getQuery();
    }
880374
public function getProductAbstractCollectionByBrandId(int $idBrand): BrandProductAbstractRelationTransfer
    {
        /** @var \Orm\Zed\BrandProduct\Persistence\FosBrandProduct[] $brandProductEntities */
        $brandProductEntities = $this->getFactory()
            ->getBrandProductQuery()
            ->findByFkBrand($idBrand);

        $productAbstractIds = [];
        foreach ($brandProductEntities as $entity) {
            $productAbstractIds[] = $entity->getFkProductAbstract();
        }

        $brandCollectionTransfer = new BrandProductAbstractRelationTransfer();
        $brandCollectionTransfer->setIdBrand($idBrand);
        $brandCollectionTransfer->setProductAbstractIds($productAbstractIds);

        return $brandCollectionTransfer;
    }
147942
public function filter(RabbitMqExchangeCollectionTransfer $rabbitMqExchangeCollectionTransfer)
    {
        $filteredRabbitMqExchangeCollectionTransfer = new RabbitMqExchangeCollectionTransfer();

        foreach ($rabbitMqExchangeCollectionTransfer->getRabbitMqExchanges() as $rabbitMqExchangeTransfer) {
            if (!$this->isBlacklisted($rabbitMqExchangeTransfer)) {
                $filteredRabbitMqExchangeCollectionTransfer->addRabbitMqExchange($rabbitMqExchangeTransfer);
            }
        }

        return $filteredRabbitMqExchangeCollectionTransfer;
    }
769800
public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()
            ->getProductAlternativeDataImport()
            ->import($dataImporterConfigurationTransfer);
    }
336568
public function createConsumer(Destination $destination): Consumer
    {
        InvalidDestinationException::assertDestinationInstanceOf($destination, FsDestination::class);

        $consumer = new FsConsumer($this, $destination, $this->preFetchCount);

        if ($this->pollingInterval) {
            $consumer->setPollingInterval($this->pollingInterval);
        }

        return $consumer;
    }
466082
public function createProductAbstractBrands(ProductAbstractTransfer $productAbstractTransfer): ProductAbstractTransfer
    {
        if ($productAbstractTransfer->getBrandCollection() !== null) {
            $requestedBrandIds = $this->getBrandIds($productAbstractTransfer->getBrandCollection());

            if (count($requestedBrandIds) > 0) {
                $this->brandProductEntityManager->addBrandProductRelations($productAbstractTransfer->getIdProductAbstract(), $requestedBrandIds);
            }

            $productAbstractTransfer->setBrandCollection($this->brandProductReader->getBrandCollectionByIdProductAbstractId($productAbstractTransfer));
        }

        return $productAbstractTransfer;
    }
1238003
protected function createComputopApiRequestTransfer(QuoteTransfer $quoteTransfer): ComputopApiRequestTransfer
    {
        return (new ComputopApiRequestTransfer())
            ->setPayId('')
            ->setMerchantId($this->config->getMerchantId())
            ->setTransId($this->computopApiService->generateLimitedTransId($quoteTransfer, static::TRANS_ID_LIMIT))
            ->setAmount($quoteTransfer->getTotals()->getPriceToPay())
            ->setCurrency($quoteTransfer->getCurrency()->getCode())
            ->setOrderDesc($this->computopApiService->getDescriptionValue($quoteTransfer->getItems()->getArrayCopy()));
    }
493753
public function add(BrandTransfer $brandTransfer): BrandResponseTransfer
    {
        $brandEntity = $this->createFosBrandEntity($brandTransfer);
        $brandEntity->save();

        $brandTransfer->setIdBrand($brandEntity->getPrimaryKey());

        $brandResponseTransfer = new BrandResponseTransfer();
        $brandResponseTransfer
            ->setIsSuccess(true)
            ->setBrandTransfer($brandTransfer);

        return $brandResponseTransfer;
    }
630458
public function getFirstBrandByProductAbstractId(int $idProductAbstract): ?BrandTransfer
    {
        /** @var \Propel\Runtime\Collection\ObjectCollection|\Orm\Zed\Brand\Persistence\FosBrand[] $brandEntities */
        $brandEntities = $this->getFactory()
            ->getBrandQuery()
            ->useFosBrandProductQuery()
                ->filterByFkProductAbstract($idProductAbstract)
            ->endUse()
            ->limit(1)
            ->find();

        if ($brandEntities->isEmpty() === false) {
            $brandProductMapper = $this->getFactory()->createBrandProductMapper();
            return $brandProductMapper->mapBrand($brandEntities->getFirst(), new BrandTransfer());
        }

        return null;
    }
908647
protected function getLoadVariantsQuery($blRemoveNotOrderables, $forceCoreTableUsage, $baseObject, $sArticleTable)
    {
        return "select " . $baseObject->getSelectFields($forceCoreTableUsage) . " from $sArticleTable where " .
                 $this->getActiveCheckQuery($forceCoreTableUsage) .
                 $this->getVariantsQuery($blRemoveNotOrderables, $forceCoreTableUsage) .
                 " order by $sArticleTable.oxsort";
    }
766522
private function paginateRecords(ActiveQueryInterface $query, $pageNumber, $count)
    {
        $offset = ($pageNumber - 1) * $count;
        $limit = $count;

        return $query->offset($offset)->limit($limit);
    }
714449
public function getFirstBrandByProductAbstractId(ProductAbstractTransfer $productAbstractTransfer): ?BrandTransfer
    {
        $productAbstractTransfer->requireIdProductAbstract();

        return $this->brandProductRepository->getFirstBrandByProductAbstractId($productAbstractTransfer->getIdProductAbstract());
    }
538285
private function shouldDoctrinePaginatorUseOutputWalkers(QueryBuilder $queryBuilder, string $resourceClass = null, string $operationName = null): bool
    {
        if (null !== $resourceClass) {
            $resourceMetadata = $this->resourceMetadataFactory->create($resourceClass);

            if (null !== $useOutputWalkers = $resourceMetadata->getCollectionOperationAttribute($operationName, 'pagination_use_output_walkers', null, true)) {
                return $useOutputWalkers;
            }
        }

        /*
         * "Cannot count query that uses a HAVING clause. Use the output walkers for pagination"
         *
         * @see https://github.com/doctrine/orm/blob/v2.6.3/lib/Doctrine/ORM/Tools/Pagination/CountWalker.php#L56
         */
        if (QueryChecker::hasHavingClause($queryBuilder)) {
            return true;
        }

        /*
         * "Cannot count query which selects two FROM components, cannot make distinction"
         *
         * @see https://github.com/doctrine/orm/blob/v2.6.3/lib/Doctrine/ORM/Tools/Pagination/CountWalker.php#L64
         */
        if (QueryChecker::hasRootEntityWithCompositeIdentifier($queryBuilder, $this->managerRegistry)) {
            return true;
        }

        /*
         * "Paginating an entity with foreign key as identifier only works when using the Output Walkers. Call Paginator#setUseOutputWalkers(true) before iterating the paginator."
         *
         * @see https://github.com/doctrine/orm/blob/v2.6.3/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryWalker.php#L77
         */
        if (QueryChecker::hasRootEntityWithForeignKeyIdentifier($queryBuilder, $this->managerRegistry)) {
            return true;
        }

        /*
         * "Cannot select distinct identifiers from query with LIMIT and ORDER BY on a column from a fetch joined to-many association. Use output walkers."
         *
         * @see https://github.com/doctrine/orm/blob/v2.6.3/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryWalker.php#L150
         */
        if (QueryChecker::hasMaxResults($queryBuilder) && QueryChecker::hasOrderByOnFetchJoinedToManyAssociation($queryBuilder, $this->managerRegistry)) {
            return true;
        }

        // Disable output walkers by default (performance)
        return false;
    }
1349166
public function request(AdyenApiRequestTransfer $requestTransfer): AdyenApiResponseTransfer
    {
        $requestData = $this->mapper->buildRequestArray($requestTransfer);
        $isSuccess = true;

        try {
            $response = $this->adapter->sendRequest($requestData);
        } catch (RequestException $requestException) {
            $response = $requestException->getResponse();
            $isSuccess = false;
        }

        return $this->converter->convertToResponseTransfer($response, $isSuccess);
    }
629357
protected function getBrand(BrandTransfer $brandTransfer): FosBrand
    {
        $brandEntity = null;

        if ($brandTransfer->getIdBrand()) {
            $brandEntity = $this->queryContainer->queryBrandById($brandTransfer->getIdBrand())
                ->findOne();
        } elseif ($brandTransfer->getName()) {
            $brandEntity = $this->queryContainer->queryBrandByName($brandTransfer->getName())
                ->findOne();
        }

        if ($brandEntity !== null) {
            return $brandEntity;
        }

        throw new BrandNotFoundException(sprintf('Brand not found by either ID `%s` or name `%s`.', $brandTransfer->getIdBrand(), $brandTransfer->getName()));
    }
1227439
protected function addBrandPropelQuery(Container $container): Container
    {
        $container[static::PROPEL_QUERY_BRAND] = function (Container $container) {
            return FosBrandQuery::create();
        };

        return $container;
    }
637633
protected function createPaymentTransfer(OrderTransfer $orderTransfer): ComputopApiRequestTransfer
    {
        $computopApiRequestTransfer = parent::createPaymentTransfer($orderTransfer);
        $computopApiRequestTransfer->setCapture(
            $this->getCaptureType(ComputopApiConfig::PAYMENT_METHOD_PAY_NOW)
        );
        $computopApiRequestTransfer->setOrderDesc($this->getOrderDesc($this->computopApiService, $orderTransfer));

        return $computopApiRequestTransfer;
    }