Conditions | 2 |
Paths | 2 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
23 | public function findFrontCategories(array $slugs) |
||
24 | { |
||
25 | $qb = $this->createQueryBuilder('category') |
||
26 | ->where('category.enabled = :enabled') |
||
27 | ->setParameter('enabled', true) |
||
28 | ->andWhere('category.slug IN ( :slugs )') |
||
29 | ->setParameter('slugs', $slugs) |
||
30 | ; |
||
31 | |||
32 | /** @var Category[] $results */ |
||
33 | $results = $qb |
||
34 | ->getQuery() |
||
35 | ->useResultCache($this->cacheEnabled, $this->cacheTtl) |
||
36 | ->getResult() |
||
37 | ; |
||
38 | |||
39 | $resultsSortedBySlug = []; |
||
40 | |||
41 | foreach ($results as $category) { |
||
42 | $resultsSortedBySlug[$category->getSlug()] = $category; |
||
43 | } |
||
44 | |||
45 | return $resultsSortedBySlug; |
||
46 | } |
||
47 | } |
||
48 |