I got this error:
Catchable Fatal Error: Object of class Symfony\Component\HttpFoundation\ParameterBag could not be converted to string
I use Symfony 3 and Doctrine Query Builder
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select('c')
->from('AppBundle:Certificate', 'c')
->where(' c.enabled = 1')
->where(' c.title LIKE :search')
->orderBy('c.title', $order)
->setParameter('search', '%' . $search . '%' );
$query = $qb->getQuery();
return $query->getResult();
I try add _toString to my Entity like this:
public function __toString() {
return $this->title;
}
but I have not changed it, I will need to use c columns for the same search with LIKE where(cc1 LIKE: search OR cc2 LIKE: search)
Is there any solution? I need to search with LIKE two columns in which the given search string and I must use %:search%
Thank you
The ParameterBag object must be for your $order or $search parameters retrieve by the request object. Try to dump it before the query in order to see what there is inside.