#1556: Doctrine_Query_Registry should add and return clone of the query
-----------------------------------+----------------------------------------
Reporter: honza.trtik | Owner: romanb
Type: defect | Status: new
Priority: minor | Milestone: Unknown
Component: Query/Hydration | Version: 1.0.2
Keywords: query registry | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 1
-----------------------------------+----------------------------------------
Folowing example is selfexplaining the issue:
{{{
$r = Doctrine_Manager::getInstance()->getQueryRegistry();
// Add new query - list ordered by permission attribute
$q1 = Doctrine_Query::create()->from('sfGuardUser')->orderBy('username');
$r->add('sfGuardUser/list', $q1);
var_dump($q1->getDql()); // string(35) " FROM sfGuardUser ORDER BY
username"
// Get this query from registry and adjust it
$q2 = $r->get('list', 'sfGuardUser');
$q2->orderBy('password');
var_dump($q2->getDql()); // string(35) " FROM sfGuardUser ORDER BY
password"
// Try to get original added query from registry
$q3 = $r->get('list', 'sfGuardUser');
var_dump($q3->getDql()); // string(35) " FROM sfGuardUser ORDER BY
password"
}}}
If you add query to registry, get it again and adjust via fluent query
interface, you change query object in registry. That is not expected
behavior, i think..
IMHO the solution is cloning query before adding and before returning.
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1556>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---