I am trying to run a query as follows in Symfony:
SELECT * FROM company
WHERE name LIKE '%$search%'
ORDER BY CASE WHEN name LIKE '$search%' THEN 1
WHEN name LIKE '%$search' THEN 2
WHEN name LIKE '%$search%' THEN 3
END
LIMIT 0,10
There seems to be a lot of the limitations with createQuery() and findBy() I was wondering if there was a way to query the DB in such a way with Symfony2?
Note, the company table is also set up as an entity.
This is what I tried which doesn't accomplish my whole query:
$this->getDoctrine()
->getRepository('testMyBundle:Company')
->findBy(array(),array(),10,($current-1)*$numItemsPerPage);
I appreciate any suggestions, thanks in advance!