1 | <?php |
||
19 | final class FrequentlyAskedQuestionRepository extends EntityRepository implements FrequentlyAskedQuestionRepositoryInterface |
||
20 | { |
||
21 | /** |
||
22 | * {@inheritdoc} |
||
23 | */ |
||
24 | public function createListQueryBuilder(string $locale): QueryBuilder |
||
25 | { |
||
26 | return $this->createQueryBuilder('o') |
||
27 | ->innerJoin('o.translations', 'translation') |
||
28 | ->where('translation.locale = :locale') |
||
29 | ->setParameter('locale', $locale) |
||
30 | ; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | */ |
||
36 | public function findEnabledOrderedByPositionAndChannelCode(string $localeCode, string $channelCode): array |
||
37 | { |
||
38 | return $this->createQueryBuilder('o') |
||
39 | ->leftJoin('o.translations', 'translation') |
||
40 | ->innerJoin('o.channels', 'channels') |
||
41 | ->where('translation.locale = :localeCode') |
||
42 | ->andWhere('o.enabled = true') |
||
43 | ->andWhere('channels.code = :channelCode') |
||
44 | ->orderBy('o.position', 'ASC') |
||
45 | ->setParameter('localeCode', $localeCode) |
||
46 | ->setParameter('channelCode', $channelCode) |
||
47 | ->getQuery() |
||
48 | ->getResult() |
||
49 | ; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function findOneEnabledByCode(string $code): ?FrequentlyAskedQuestionInterface |
||
65 | } |
||
66 |