* * @method Document|null find($id, $lockMode = null, $lockVersion = null) * @method Document|null findOneBy(array $criteria, array $orderBy = null) * @method Document[] findAll() * @method Document[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class DocumentRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Document::class); } public function findDocument(int $id): ?Document { return $this->createQueryBuilder('document') ->andWhere('document.id = :val') ->setParameter('val', $id) ->getQuery() ->getOneOrNullResult() ; } public function findAllByDocumentCategory(DocumentCategory $document_category): array { $query = $this->createQueryBuilder('document') ->andWhere('document.document_category_id = :val1') ->setParameter('val1', $document_category->getId()) ->orderBy('document.id', 'ASC') ->getQuery() ->getResult() ; } // /** // * @return Document[] Returns an array of Document objects // */ // public function findByExampleField($value): array // { // return $this->createQueryBuilder('u') // ->andWhere('u.exampleField = :val') // ->setParameter('val', $value) // ->orderBy('u.id', 'ASC') // ->setMaxResults(10) // ->getQuery() // ->getResult() // ; // } // public function findOneBySomeField($value): ?Document // { // return $this->createQueryBuilder('u') // ->andWhere('u.exampleField = :val') // ->setParameter('val', $value) // ->getQuery() // ->getOneOrNullResult() // ; // } }