-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
product filters on search page are now provided via Luigi's Box
- Loading branch information
1 parent
b05634e
commit d42f640
Showing
12 changed files
with
330 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shopsys\LuigisBoxBundle\Model\Brand; | ||
|
||
use Doctrine\ORM\EntityManagerInterface; | ||
use Doctrine\ORM\EntityRepository; | ||
use Shopsys\FrameworkBundle\Component\Doctrine\OrderByCollationHelper; | ||
use Shopsys\FrameworkBundle\Component\Domain\Domain; | ||
use Shopsys\FrameworkBundle\Model\Product\Brand\Brand; | ||
|
||
class BrandRepository | ||
{ | ||
/** | ||
* @param \Doctrine\ORM\EntityManagerInterface $em | ||
* @param \Shopsys\FrameworkBundle\Component\Domain\Domain $domain | ||
*/ | ||
public function __construct( | ||
protected readonly EntityManagerInterface $em, | ||
protected readonly Domain $domain, | ||
) { | ||
} | ||
|
||
/** | ||
* @return \Doctrine\ORM\EntityRepository | ||
*/ | ||
protected function getBrandRepository(): EntityRepository | ||
{ | ||
return $this->em->getRepository(Brand::class); | ||
} | ||
|
||
/** | ||
* @param string[] $brandNames | ||
* @return \Shopsys\FrameworkBundle\Model\Product\Brand\Brand[] | ||
*/ | ||
public function getBrandsByNames(array $brandNames): array | ||
{ | ||
$queryBuilder = $this->getBrandRepository() | ||
->createQueryBuilder('b') | ||
->andWhere('b.name IN(:brandNames)'); | ||
$queryBuilder->setParameter('brandNames', $brandNames); | ||
$queryBuilder->orderBy(OrderByCollationHelper::createOrderByForLocale('b.name', $this->domain->getLocale())); | ||
|
||
return $queryBuilder->getQuery()->getResult(); | ||
} | ||
} |
Oops, something went wrong.