Source of file RegionRepository.php

Size: 1,057 Bytes - Last Modified: 2023-11-16T22:56:03+01:00

/home/websites/teicee/packagist/site/phpdoc/conf/../vendor/teicee/town-bundle/src/Repository/RegionRepository.php

123456789101112131415161718192021222324252627282930313233343536373839404142
<?php
namespace TIC\TownBundle\Repository;

use TIC\TownBundle\Entity\Region as RepoEntity;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

/**
 * RegionRepository.
 *
 * @method Region|null find($id, $lockMode = null, $lockVersion = null)
 * @method Region|null findOneBy(array $criteria, array $orderBy = null)
 * @method Region[]    findAll()
 * @method Region[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
 */
class RegionRepository extends ServiceEntityRepository
{

	public function __construct(ManagerRegistry $registry)
	{
		parent::__construct($registry, RepoEntity::class);
	}


	public $sortBy = array('nom_maj' => 'ASC');


	/**
	 * Recherche basique.
	 */
	public function searchBasic(string $term, ?int $limit=20)
	{
		return $this->createQueryBuilder('d')
			->select('d.insee AS id, d.nom AS text')
			->where('d.nom LIKE :term')->setParameter('term', '%'.$term.'%')
			->setMaxResults($limit)
			->getQuery()->getArrayResult()
		;
	}

}