Skip to content

Commit

Permalink
Add fix for phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
Szymon Kostrubiec committed Jul 9, 2024
1 parent d51327d commit 809b203
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/Repository/ProductOptionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace BitBag\SyliusElasticsearchPlugin\Repository;

use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Sylius\Component\Resource\Repository\RepositoryInterface;

Expand All @@ -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')
Expand All @@ -37,6 +39,7 @@ public function findAllWithTranslations(?string $locale): array
}

return $queryBuilder
->createQueryBuilder('o')
->getQuery()
->getResult()
;
Expand Down
3 changes: 2 additions & 1 deletion src/Repository/ProductVariantRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 809b203

Please sign in to comment.