| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public function countBy(array $criteria) |
||
| 33 | { |
||
| 34 | $queryBuilder = $this->createQueryBuilder('a')->select('COUNT(a)') |
||
| 35 | ; |
||
| 36 | foreach ($criteria as $name => $criterion) { |
||
| 37 | $queryBuilder |
||
| 38 | ->andWhere($name . ' = :criterion_' . $name) |
||
| 39 | ->setParameter('criterion_' . $name, $criterion); |
||
| 40 | } |
||
| 41 | |||
| 42 | return $queryBuilder->getQuery()->getSingleScalarResult(); |
||
| 43 | } |
||
| 44 | } |
||
| 45 |