I have this query in Symfony 2. It works great but I was wondering if it was possible to make something cleaner.
I'm new to Symfony and QueryBuilder and I couldn't get to do something that works with the queryBuilder.
$em = $this->getEntityManager();
$query = $em->createQuery(
'SELECT t '.
'FROM MyBundle:Task t '.
'WHERE t.folder IN '.
'(SELECT f.id '.
'FROM MyBundle:Folder f '.
'WHERE f.priority = '.$prio.
' AND f.user IN '.
'(SELECT u.id '.
'FROM MyBundle:User u '.
'WHERE u.id ='.$user->getId().'))');
The scheme is simple A User has Many Folders, a Folder has many Tasks and I m looking for all tasks for one user.
Thanks a lot !