How to create a search like query on all columns of a table using DQL?

Im new to DQL so i dont know how to implement the search logic.

name: UsersTable

------------------------------
| id |   name   |  lastname  |
------------------------------
| 01 | user     |  one       |
------------------------------
| 02 | user     |  one1      |
------------------------------

so if the search value is
$search = ‘user o’;
and the dql is

$query = $entityManager->createQuery(
'SELECT p
FROM AppBundle:UsersTable p
WHERE "search condition here"
)->setParameter('', '');
$result = $query->getResult();

So the expected result should be both ‘user one’ and ‘user one1’ since they both reflect the search value which is ‘user o’.

Need help on this please.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *