<?php
namespace App\Repository\Admin;
use App\Entity\Admin\Apropos;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Apropos|null find($id, $lockMode = null, $lockVersion = null)
* @method Apropos|null findOneBy(array $criteria, array $orderBy = null)
* @method Apropos[] findAll()
* @method Apropos[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class AproposRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Apropos::class);
}
public function findLastApropos()
{
return $this->createQueryBuilder('a')
->orderBy('a.id', 'DESC')
->setMaxResults(1)
->getQuery()
->getResult()
;
}
public function countAproposs()
{
$qb = $this->createQueryBuilder('a');
return $qb
->select('count(a.id)' )
->getQuery()
->getSingleScalarResult();
}
}