[DDC-2105] Error when rendering DQL query Created: 26/Oct/12  Updated: 23/Dec/12  Resolved: 23/Dec/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: 2.3
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Marcos García Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: dql
Environment:

Mac OS X Mountain Lion
PHP 5.3.14 (cli)



 Description   

I'm using Doctrine with Symfony 2.1. Everything was working OK in Symfony 2.0 so I think I was using Doctrine 2.2. Now I'm using Doctrine 2.3-dev (packagist) and when I run the following query in a EntityRepository:

$em->createQuery('SELECT u, tc FROM XBundle:X tc JOIN tc.usuario u JOIN tc.tax t WHERE tc.timestamp >= :date_from AND tc.timestamp <= :date_to AND t.type = :x GROUP BY tc.usuario');

Nothing happens, getResult() just returns array(0){}

I've done \Doctrine\Common\Util\Debug::dump($query); and this is the result:

object(stdClass)#487 (18) {
  ["__CLASS__"]=>
  string(18) "Doctrine\ORM\Query"
  ["_state"]=>
  int(1)
  ["_dql"]=>
  string(180) "SELECT u, tc FROM XBundle:X tc JOIN tc.usuario u JOIN tc.tax t WHERE tc.timestamp >= :date_from AND tc.timestamp Marcos:project marcos$ 

As you can see something happens because the dql query got cropped and seems like Doctrine is not working properly...

If I change 'WHERE tc.timestamp >= :date_from AND tc.timestamp <= :date_to' for 'WHERE tc.timestamp BETWEEN :date_from AND :date_to', then the query is run without any problem and the debug dump function shows a complete debug of $query.



 Comments   
Comment by Fabio B. Silva [ 29/Oct/12 ]

Hi Marcos,

Could you try to add a failing test case ?

Thanks ...

Comment by Marcos García [ 23/Dec/12 ]

Hi Fabio,

I've updated Doctrine and now it seems that everything works OK...

Thank you for your time... (and sorry) :S

Generated at Wed Oct 22 22:43:42 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.