I added a filter to my project that works with symfony.
I have the ID (numbers to be searched) and the client name. When I constructed my query with one parameter, it works, just like that
public function findFilter($filter)
{
return $this->createQueryBuilder("a")
->andWhere('a.id like :id')
->setParameter('id', '%' . $filter . '%')
->getQuery()
;
}
and when I add one more parameter, the search doesn't happen.
public function findFilter($filter)
{
return $this->createQueryBuilder("a")
->andWhere('a.id like :id')
->setParameter('id', '%' . $filter . '%')
->andWhere('a.client like :client')
->setParameter('client', '%' . $filter . '%')
->getQuery()
;
}
and here is my view where the filter can be entered
<form action="" method="get">
<input name="filter" type="text">
<button type="submit" class="btn btn-default">Filtrer</button>
</form>
So maybe I'm not sticking them right? Anyone got an idea on how to add more parameters for the filter bar?