| @@ 10-20 (lines=11) @@ | ||
| 7 | ||
| 8 | class NodeRepository extends EntityRepository |
|
| 9 | { |
|
| 10 | public function findAllWithLocale($locale) |
|
| 11 | { |
|
| 12 | return $this |
|
| 13 | ->createQueryBuilder('n') |
|
| 14 | ->andWhere('n.published = true') |
|
| 15 | ->andWhere('n.locale = :locale') |
|
| 16 | ->setParameter('locale', $locale) |
|
| 17 | ->orderBy('n.position', 'ASC') |
|
| 18 | ->getQuery() |
|
| 19 | ->getResult(); |
|
| 20 | } |
|
| 21 | ||
| 22 | public function findOnePublishedBySlug($slug) |
|
| 23 | { |
|
| @@ 33-44 (lines=12) @@ | ||
| 30 | ->getOneOrNullResult(); |
|
| 31 | } |
|
| 32 | ||
| 33 | public function findOnePublishedBySlugAndLocale($slug, $locale) |
|
| 34 | { |
|
| 35 | return $this |
|
| 36 | ->createQueryBuilder('n') |
|
| 37 | ->andWhere('n.published = true') |
|
| 38 | ->andWhere('n.locale = :locale') |
|
| 39 | ->andWhere('n.slug = :slug') |
|
| 40 | ->setParameter('locale', $locale) |
|
| 41 | ->setParameter('slug', $slug) |
|
| 42 | ->getQuery() |
|
| 43 | ->getOneOrNullResult(); |
|
| 44 | } |
|
| 45 | ||
| 46 | public function findTranslation(Node $node, $locale) |
|
| 47 | { |
|