I had to do some looking to find how to do an ‘or’ statement in symfony with propel. I found out at a google’s group here and the api documentation from propel is here. Once I found the information it was surprisingly easy. Below is the code I ended up using to select records either updated in the last two weeks OR activities that are delayed AND activities that the posting times are NULL (implying they are not posted yet).
$c = new Criteria(); $c->AddDescendingOrderByColumn(ActivityInfoPeer::ACTIVITY_EVENT_TIME); $criterion = $c->getNewCriterion( ActivityInfoPeer::UPDATED_AT, date("Y-m-d H:i:s", time() - 1209600), Criteria::GREATER_THAN)->addOr( $c->getNewCriterion(ActivityInfoPeer::ACTIVITY_DELAYED, 1, Criteria::EQUAL) )->addAnd($c->getNewCriterion(ActivityInfoPeer::ACTIVITY_POST_TIME, null, Criteria::ISNULL) ); $c->add($criterion); $this->pending_activities = ActivityInfoPeer::doSelect($c);
Till Next Time