Added book search.

This commit is contained in:
krzysiej
2022-06-03 15:17:46 +02:00
parent b21d213b19
commit 314f4f2a14
10 changed files with 192 additions and 46 deletions

View File

@@ -39,20 +39,18 @@ class BookRepository extends ServiceEntityRepository
}
}
// /**
// * @return Book[] Returns an array of Book objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('b')
// ->andWhere('b.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('b.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
/**
* @return Book[] Returns an array of Book objects
*/
public function findByTitle($value): array
{
return $this->createQueryBuilder('b')
->andWhere('LOWER(b.title) LIKE :title')
->setParameter('title', '%' . strtolower($value) . '%')
->orderBy('b.id', 'ASC')
->getQuery()
->getResult();
}
// public function findOneBySomeField($value): ?Book
// {