UnionOfRAD/lithium — pull request #705 by jails (2012-12-04 03:25:45+00:00)
Title: Implementing new features for queries Warning BC BREAK

BC break:
- the `'constraint'` option is now called `'constraints'` (i.e with an extra 's')
- Query::constraints() has been removed (see Database::on() for PDO datasources)

- Query has been refactored (is doesn't build the join's contraints)
- Queries are now exported according a datasource strategy (Acutally only the joined strategy (i.e. LEFT JOIN) have been implemented).
- Deep aliasing support. If Models define constraints in their relationship (i.e. 'constraints => array('Model1.id' => 'Model2.model1_id), Model1 and/or Model2 will be automagically aliased to avoid conflicts and make nested 'with' works as expected
- 'condititions' are unchanged (i.e. 'name escaped' => 'string escaped')
- 'constraints' are unchanged (i.e. 'name escaped' => 'name escaped'). However (object) casted value will now not be escaped.

Futur developments :
- Allow Queries to contain subqueries
- Allow Datasource to manage queries with subqueries.
- Implements the "subquery strategy" for both PDO and NoSql datasource.

Ps:
Good luck for the reviewer ;-)