src/Repository/ConversationRepository.php line 46

Open in your IDE?
  1. <?php
  2. namespace App\Repository;
  3. use App\Entity\Conversation;
  4. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  5. use Doctrine\Persistence\ManagerRegistry;
  6. /**
  7.  * @extends ServiceEntityRepository<Conversation>
  8.  *
  9.  * @method Conversation|null find($id, $lockMode = null, $lockVersion = null)
  10.  * @method Conversation|null findOneBy(array $criteria, array $orderBy = null)
  11.  * @method Conversation[]    findAll()
  12.  * @method Conversation[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  13.  */
  14. class ConversationRepository extends ServiceEntityRepository
  15. {
  16.     public function __construct(ManagerRegistry $registry)
  17.     {
  18.         parent::__construct($registryConversation::class);
  19.     }
  20.     public function add(Conversation $entitybool $flush false): void
  21.     {
  22.         $this->getEntityManager()->persist($entity);
  23.         if ($flush) {
  24.             $this->getEntityManager()->flush();
  25.         }
  26.     }
  27.     public function remove(Conversation $entitybool $flush false): void
  28.     {
  29.         $this->getEntityManager()->remove($entity);
  30.         if ($flush) {
  31.             $this->getEntityManager()->flush();
  32.         }
  33.     }
  34.     public function getControlConversation($client)
  35.     {
  36.         $avecTeleconseil ' ';
  37.         if (strlen(trim($teleconseiller)) > 0$avecTeleconseil " and H.id_user ='$teleconseiller'";
  38.         $avecDate ' ';
  39.         if (strlen($date_debutct) > && ($date_finct) > 0$avecDate "and H.created_at BETWEEN '$date_debutct' AND '$date_finct'";
  40.         $RQ =$this->_em->createQueryBuilder();
  41.         $RQ->select('P.libelle as libelle','COALESCE(Count(H.id),0) as Nbre')
  42.         ->from(HistoriqueAppel::class, 'H')
  43.         ->innerJoin('H.id_profession''P')
  44.         ->where("H.statut =1
  45.             $avecTeleconseil
  46.             $avecDate
  47.             ")
  48.         ->groupBy('P.id');
  49.         return $RQ->getQuery()
  50.                 ->getResult();
  51.     }
  52. //    /**
  53. //     * @return Conversation[] Returns an array of Conversation objects
  54. //     */
  55. //    public function findByExampleField($value): array
  56. //    {
  57. //        return $this->createQueryBuilder('c')
  58. //            ->andWhere('c.exampleField = :val')
  59. //            ->setParameter('val', $value)
  60. //            ->orderBy('c.id', 'ASC')
  61. //            ->setMaxResults(10)
  62. //            ->getQuery()
  63. //            ->getResult()
  64. //        ;
  65. //    }
  66. //    public function findOneBySomeField($value): ?Conversation
  67. //    {
  68. //        return $this->createQueryBuilder('c')
  69. //            ->andWhere('c.exampleField = :val')
  70. //            ->setParameter('val', $value)
  71. //            ->getQuery()
  72. //            ->getOneOrNullResult()
  73. //        ;
  74. //    }
  75. }