src/Repository/AccessKeyModeTranslationRepository.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Repository;
  3. use App\Entity\AccessKeyModeTranslation;
  4. use App\Entity\Collective;
  5. use App\Entity\Locale;
  6. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  7. use Doctrine\Common\Persistence\ManagerRegistry;
  8. /**
  9.  * @method AccessKeyModeTranslation|null find($id, $lockMode = null, $lockVersion = null)
  10.  * @method AccessKeyModeTranslation|null findOneBy(array $criteria, array $orderBy = null)
  11.  * @method AccessKeyModeTranslation[]    findAll()
  12.  * @method AccessKeyModeTranslation[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  13.  */
  14. class AccessKeyModeTranslationRepository extends ServiceEntityRepository
  15. {
  16.     /**
  17.      * AccessKeyModeTranslationRepository constructor.
  18.      * @param ManagerRegistry $registry
  19.      */
  20.     public function __construct(ManagerRegistry $registry)
  21.     {
  22.         parent::__construct($registryAccessKeyModeTranslation::class);
  23.     }
  24.     /**
  25.      * @param Collective $collective
  26.      * @param Locale $locale
  27.      * @return mixed
  28.      */
  29.     public function findByCollectiveAndLocale(Collective $collectiveLocale $locale)
  30.     {
  31.         return $this->createQueryBuilder('at')
  32.             ->join('at.accessKeyMode''a')
  33.             ->join('at.locale''l')
  34.             ->join('a.collectives''c')
  35.             ->andWhere('c.id = :collective')
  36.             ->andWhere('l.id = :locale')
  37.             ->setParameter('collective'$collective->getId())
  38.             ->setParameter('locale'$locale->getId())
  39.             ->getQuery()
  40.             ->getResult()
  41.         ;
  42.     }
  43. }