src/Repository/Admin/AproposRepository.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Repository\Admin;
  3. use App\Entity\Admin\Apropos;
  4. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  5. use Doctrine\ORM\Query;
  6. use Doctrine\Persistence\ManagerRegistry;
  7. /**
  8.  * @method Apropos|null find($id, $lockMode = null, $lockVersion = null)
  9.  * @method Apropos|null findOneBy(array $criteria, array $orderBy = null)
  10.  * @method Apropos[]    findAll()
  11.  * @method Apropos[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  12.  */
  13. class AproposRepository extends ServiceEntityRepository
  14. {
  15.     public function __construct(ManagerRegistry $registry)
  16.     {
  17.         parent::__construct($registryApropos::class);
  18.     }
  19.     public function findLastApropos()
  20.     {
  21.         return $this->createQueryBuilder('a')
  22.             ->orderBy('a.id''DESC')
  23.             ->setMaxResults(1)
  24.             ->getQuery()
  25.             ->getResult()
  26.             ;
  27.     }
  28.     public function countAproposs()
  29.     {
  30.         $qb $this->createQueryBuilder('a');
  31.         return $qb
  32.             ->select('count(a.id)' )
  33.             ->getQuery()
  34.             ->getSingleScalarResult();
  35.     }
  36. }