refactored search with free search term support (#1064)

This commit is contained in:
Kevin Papst
2019-09-04 18:54:06 +02:00
committed by GitHub
parent 49e1a1c410
commit e99b170d0a
147 changed files with 2071 additions and 1322 deletions

View File

@@ -104,9 +104,17 @@ class TeamRepository extends EntityRepository
$qb
->select('t')
->from(Team::class, 't')
->addOrderBy('t.' . $query->getOrderBy(), $query->getOrder())
;
$qb->orderBy('t.' . $query->getOrderBy(), $query->getOrder());
if (!empty($query->getSearchTerm())) {
$qb->andWhere(
$qb->expr()->orX(
$qb->expr()->like('t.name', ':likeContains')
)
);
$qb->setParameter('likeContains', '%' . $query->getSearchTerm() . '%');
}
return $qb;
}