[DDC-2285] Repeating the same query with different parameter value returns the same results Created: 08/Feb/13 Updated: 08/Feb/13 Resolved: 08/Feb/13 |
|
| Status: | Closed |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL, Mapping Drivers, ORM |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Mehdi Bakhtiari | Assignee: | Marco Pivetta |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 12.10, Zend Server CE |
||
| Description |
$activeAdsCustomers = \Ez\Registry::getDoctrineEntityManager()
->createQuery( "SELECT c, a FROM \Spot101\Model\Ad\Customer c JOIN c.ads a WHERE a.status = :status" )
->setParameter( "status", \Spot101\Model\Ad\Status::ACTIVE )
->getResult();
$inactiveAdsCustomers = \Ez\Registry::getDoctrineEntityManager()
->createQuery( "SELECT c, a FROM \Spot101\Model\Ad\Customer c JOIN c.ads a WHERE a.status = :status" )
->setParameter( "status", \Spot101\Model\Ad\Status::INACTIVE )
->getResult();
Having the code above I am getting the same results for $inactiveAdsCustomers as I get for $activeAdsCustomers. And when I try hydrating the results everything works so fine. Both queries look the same except the value provided for the "status" parameter. |
| Comments |
| Comment by Marco Pivetta [ 08/Feb/13 ] |
|
You are hydrating joined and filtered resultsets. You should never do this, as this will hydrate an invalid association into your objects. |