diff --git a/src/Repository/ProductOptionRepository.php b/src/Repository/ProductOptionRepository.php index df513c81..0c0dff46 100644 --- a/src/Repository/ProductOptionRepository.php +++ b/src/Repository/ProductOptionRepository.php @@ -12,6 +12,7 @@ namespace BitBag\SyliusElasticsearchPlugin\Repository; +use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; use Sylius\Component\Resource\Repository\RepositoryInterface; @@ -24,11 +25,12 @@ public function __construct( public function findAllWithTranslations(?string $locale): array { - /** @var QueryBuilder $queryBuilder */ - $queryBuilder = $this->productOptionRepository->createQueryBuilder('o'); + /** @var EntityRepository $queryBuilder */ + $queryBuilder = $this->productOptionRepository; if (null !== $locale) { $queryBuilder + ->createQueryBuilder('o') ->addSelect('translation') ->leftJoin('o.translations', 'translation', 'ot') ->andWhere('translation.locale = :locale') @@ -37,6 +39,7 @@ public function findAllWithTranslations(?string $locale): array } return $queryBuilder + ->createQueryBuilder('o') ->getQuery() ->getResult() ; diff --git a/src/Repository/ProductVariantRepository.php b/src/Repository/ProductVariantRepository.php index 3abc9871..1deb424f 100644 --- a/src/Repository/ProductVariantRepository.php +++ b/src/Repository/ProductVariantRepository.php @@ -29,7 +29,8 @@ public function findOneByOptionValue(ProductOptionValueInterface $productOptionV /** @var EntityRepository $productOptionValue */ $productOptionValue = $this->baseProductVariantRepository; - return $productOptionValue->createQueryBuilder('o') + return $productOptionValue + ->createQueryBuilder('o') ->where(':optionValue MEMBER OF o.optionValues') ->setParameter('optionValue', $productOptionValue) ->getQuery()