Source of file FooBarRepository.php
Size: 1,357 Bytes - Last Modified: 2023-11-16T22:56:03+01:00
/home/websites/teicee/packagist/site/phpdoc/conf/../vendor/teicee/make-bundle/acme/src/Repository/FooBarRepository.php
| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 | <?phpnamespace TIC\AcmeBundle\Repository; use TIC\DormBundle\Base\TICRepository as BaseRepository; #use Doctrine\Common\Persistence\ManagerRegistry;#use App\Entity\FooBar;use Doctrine\ORM\QueryBuilder; use TIC\AcmeBundle\Entity\FooBar as RepoEntity; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; /** * Repository pour les requêtes sur les entités FooBar. * * @method FooBar|null find($id, $lockMode = null, $lockVersion = null) * @method FooBar|null findOneBy(array $criteria, array $orderBy = null) * @method FooBar[] findAll() * @method FooBar[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */class FooBarRepository extends BaseRepository {# public $alias = 'a';# public $sortBy = ['name' => 'ASC'];/** * Application des filtres sur un query builder. * * @param array $filters * @param mixed $qb * @return QueryBuilder */public function qbFilters(array $filters = array(), $qb = null): QueryBuilder { $a = $this->initQB(parent::qbFilters($filters, $qb)) . '.'; foreach ($filters as $type => $value) switch ($type) { // ajouter ici les filtres personnalisés pour les recherches de ce repository... case 'name': if ($value !== null) $qb->andWhere($a.$type.' = :'.$type)->setParameter($type, $value); break; } return $qb; } } |