1 | <?php |
||
24 | class ProductRepository extends BaseProductRepository implements ProductRepositoryInterface |
||
25 | { |
||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | public function createListQueryBuilder($locale, $taxonId = null) |
||
30 | { |
||
31 | $queryBuilder = $this->createQueryBuilder('o'); |
||
32 | |||
33 | $queryBuilder |
||
34 | ->addSelect('translation') |
||
35 | ->leftJoin('o.translations', 'translation') |
||
36 | ->andWhere('translation.locale = :locale') |
||
37 | ->setParameter('locale', $locale) |
||
38 | ; |
||
39 | |||
40 | if (null !== $taxonId) { |
||
41 | $queryBuilder |
||
42 | ->innerJoin('o.productTaxons', 'productTaxon') |
||
43 | ->andWhere('productTaxon.taxon = :taxonId') |
||
44 | ->setParameter('taxonId', $taxonId) |
||
45 | ; |
||
46 | } |
||
47 | |||
48 | return $queryBuilder; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | public function createQueryBuilderByChannelAndTaxonId(ChannelInterface $channel, $taxonId, $locale) |
||
55 | { |
||
56 | return $this->createQueryBuilder('o') |
||
57 | ->addSelect('translation') |
||
58 | ->leftJoin('o.translations', 'translation') |
||
59 | ->innerJoin('o.productTaxons', 'productTaxon') |
||
60 | ->innerJoin('o.channels', 'channel') |
||
61 | ->andWhere('translation.locale = :locale') |
||
62 | ->andWhere('productTaxon.taxon = :taxonId') |
||
63 | ->andWhere('channel = :channel') |
||
64 | ->andWhere('o.enabled = true') |
||
65 | ->setParameter('locale', $locale) |
||
66 | ->setParameter('taxonId', $taxonId) |
||
67 | ->setParameter('channel', $channel) |
||
68 | ; |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * {@inheritdoc} |
||
73 | */ |
||
74 | public function findLatestByChannel(ChannelInterface $channel, $count) |
||
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | public function findOneBySlugAndChannel($slug, ChannelInterface $channel) |
||
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | public function findOneBySlug($slug) |
||
120 | } |
||
121 |