I have a User entity with firstName and lastName fields. How can I search full name in any order. For example search 'John Doe', 'Doe John', 'John D' and get relevant results
Here is my current query. But I can search by only one column at a time, i.e either get result matching to 'firstName' or 'lastName'. For Example, I get results for 'John' or 'Doe', but not for 'John Doe'
$likeName = $name.'%';
$qb = $this->createQueryBuilder('user')
->where($qb->expr()->orX(
$qb->expr()->like('user.firstName', "'$likeName'"),
$qb->expr()->like('user.lastName', "'$likeName'")
);