Reputation: 245
I'm trying to learn Propel especially about the Criteria Class on http://api.propelorm.org/1.3.0/runtime/propel-util/Criteria.html#class_details..
But I'm having a hard time understanding this thru that page. Can anyone please provide me better sites where I can read or watch tutorials on Criteria Class (preferably with PHP)?
Upvotes: 1
Views: 2574
Reputation: 22756
First, if you want to start with Propel you should take a look at the last version, 1.6.9, and not the 1.3.0.
Second, instead of diving into the code (even if it's a good idea), it's better to start with the official documentation, with concrete example: http://propelorm.org/reference/model-criteria.html
Criteria
class are really related to Propel < 1.4.x. It's still exists in Propel 1.6.x, because it can achieve very complex query. But since the 1.6.0 version, there is ModelCriteria
which handle query in more readable way, more human, more like Doctrine does.
ModelCriteria:
$books = BookQuery::create()
->useAuthorQuery('a', 'left join')
->filterByName('Leo Tolstoi')
->endUse()
->find();
Criteria:
$c = new Criteria();
$c->addJoin(AuthorPeer::BOOK_ID, BookPeer::ID, Criteria::INNER_JOIN);
$c->add(AuthorPeer::NAME, 'Leo Tolstoi');
$books = BookPeer::doSelect($c);
Upvotes: 1