Created
February 2, 2017 14:18
-
-
Save lsmith77/6f352592b0a460fb0886f4cec82d51de to your computer and use it in GitHub Desktop.
propel join with additional condition on a date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// also tried using addJoinObject + addJoinCondition but either way the condition just gets ignored | |
$results = $this->getFooQuery() | |
->addJoin( | |
FooTableMap::COL_ID, | |
BarTableMap::COL_ITEM_ID, | |
Criteria::LEFT_JOIN | |
) | |
->addCond(BarTableMap::COL_UPDATED_AT, $updatedAt->format('Y-m-d H:i:s'), Criteria::LESS_THAN) | |
->toString() | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: http://propelorm.org/blog/2010/02/16/propel-query-by-example.html
/*
*/
// Propel 1.4
$c = new Criteria();
$c->addJoin(ArticlePeer::AUTHOR_ID, AuthorPeer::ID);
$c->add(AuthorPeer::NAME, 'John Doe');
$articles = ArticlePeer::doSelect($c);
// Propel 1.5
$articles = ArticleQuery::create()
->useAuthorQuery()
->filterByName('John Doe')
->endUse()
->find()