Trac
Doctrine_Criteria API
Doctrine_Criteria will use internally a Doctrine_Query to handle execution. The Doctrine_Query is intended to exist the entire Doctrine_Criteria lifetime, but it should never be accessible (unreachable even doing getQuery()).
The Criteria API should provide delegate calls to Doctrine_Query if they do not exist in the class. This will enable us to handle $c->setHydrationMode(), without having to create aliases (which strengths the coupling between these objects).
$me = <<< guilhermeblanco
Criteria_XXX classes should have small names and descriptive ones. Everyone will dislike if we do something like:
// DQL: "( u.id = ? )" / Params = array( 1 ) $c->add( new Doctrine_Criteria_Conditional_Equals( 'u.id', 1 ) );
Another situation:
// DQL: "( u.name LIKE ( ? ) ) AND ( u.id != ? ) AND ( u.managerLevel < ? )" / Params = array( '%blanco%', 1, 100 )
$c->add( new Doctrine_Criteria_Container_And(
new Doctrine_Criteria_Conditional_Like( 'u.name', '%blanco%' ),
new Doctrine_Criteria_Conditional_NotEquals( 'u.id', 1 ),
new Doctrine_Criteria_Conditional_LessEquals( 'u.managerLevel', 100 )
) );
Please EVERYONE try to think in a better, simpler, smaller, intuitive API.
guilhermeblanco;
Creating Doctrine_Criteria instance
We should consider to create an instance and already populate it if a base Criteria is passed. This should be considered as: "Create new Criteria instance with this basic assignments"
$c = new Doctrine_Criteria(); // OR $c = $manager->createCriteria(); // OR $c = Doctrine_Criteria::create(); // With Base assignments $c2 = new Doctrine_Criteria($c); // OR $c2 = $manager->createCriteria($c); // OR $c2 = Doctrine_Criteria::create($c);
TBD