src/Entity/Repository/FaqCategoryRepository.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Repository;
  3. use App\Entity\FaqCategory;
  4. use Doctrine\ORM\EntityRepository;
  5. /**
  6.  * @method FaqCategory|null find($id, $lockMode = null, $lockVersion = null)
  7.  * @method FaqCategory|null findOneBy(array $criteria, array $orderBy = null)
  8.  * @method FaqCategory[]    findAll()
  9.  * @method FaqCategory[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  10.  */
  11. class FaqCategoryRepository extends EntityRepository
  12. {
  13.     public function getByCategory(int $id): ?FaqCategory
  14.     {
  15.         return $this->createQueryBuilder('fc')
  16.             ->andWhere('fc.id = :id')
  17.             ->setParameter('id'$id)
  18.             ->andWhere('fc.isPublished = 1')
  19.             ->getQuery()->getOneOrNullResult();
  20.     }
  21. }