public function getInterests($criteria = null, $con = null) { include_once 'lib/model/om/BaseInterestPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collInterests === null) { if ($this->isNew()) { $this->collInterests = array(); } else { $criteria->add(InterestPeer::QUESTION_ID, $this->getId()); InterestPeer::addSelectColumns($criteria); $this->collInterests = InterestPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(InterestPeer::QUESTION_ID, $this->getId()); InterestPeer::addSelectColumns($criteria); if (!isset($this->lastInterestCriteria) || !$this->lastInterestCriteria->equals($criteria)) { $this->collInterests = InterestPeer::doSelect($criteria, $con); } } } $this->lastInterestCriteria = $criteria; return $this->collInterests; }
public static function retrieveByPK($question_id, $user_id, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(); $criteria->add(InterestPeer::QUESTION_ID, $question_id); $criteria->add(InterestPeer::USER_ID, $user_id); $v = InterestPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }