| Current Path : /var/www/nsr_sok/current/src/Repository/ |
| Current File : /var/www/nsr_sok/current/src/Repository/EnhetRepository.php |
<?php
namespace App\Repository;
use App\Entity\Enhet;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Enhet|null find($id, $lockMode = null, $lockVersion = null)
* @method Enhet|null findOneBy(array $criteria, array $orderBy = null)
* @method Enhet[] findAll()
* @method Enhet[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class EnhetRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Enhet::class);
}
// /**
// * @return Enhet[] Returns an array of Enhet objects
// */
public function findByName($value)
{
return $this->createQueryBuilder('e')
->andWhere('e.navn LIKE :val')
->setParameter('val', '%'.$value.'%')
->orderBy('e.id', 'ASC')
->setMaxResults(20)
->getQuery()
->getResult()
;
}
/*
public function findOneBySomeField($value): ?Enhet
{
return $this->createQueryBuilder('e')
->andWhere('e.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}