| 1: | <?php |
| 2: | namespace TIC\AcmeBundle\Repository; |
| 3: | |
| 4: | use TIC\DormBundle\Base\TICRepository as BaseRepository; |
| 5: | |
| 6: | |
| 7: | use Doctrine\ORM\QueryBuilder; |
| 8: | |
| 9: | use TIC\AcmeBundle\Entity\FooBar as RepoEntity; |
| 10: | use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | class FooBarRepository extends BaseRepository |
| 21: | { |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | |
| 30: | |
| 31: | |
| 32: | public function qbFilters(array $filters = array(), $qb = null): QueryBuilder |
| 33: | { |
| 34: | $a = $this->initQB(parent::qbFilters($filters, $qb)) . '.'; |
| 35: | |
| 36: | foreach ($filters as $type => $value) switch ($type) { |
| 37: | |
| 38: | case 'name': |
| 39: | if ($value !== null) $qb->andWhere($a.$type.' = :'.$type)->setParameter($type, $value); |
| 40: | break; |
| 41: | } |
| 42: | return $qb; |
| 43: | } |
| 44: | |
| 45: | } |