/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this Production has previously * been saved, it will retrieve related Onlines from storage. * If this Production is new, it will return * an empty collection or the current collection, the criteria * is ignored on a new object. * * @param Connection $con * @param Criteria $criteria * @throws PropelException */ public function getOnlines($criteria = null, $con = null) { // include the Peer class include_once 'src/model/whiteboard/om/BaseOnlinePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collOnlines === null) { if ($this->isNew()) { $this->collOnlines = array(); } else { $criteria->add(OnlinePeer::PRODUCTION_ID, $this->getProductionId()); OnlinePeer::addSelectColumns($criteria); $this->collOnlines = OnlinePeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(OnlinePeer::PRODUCTION_ID, $this->getProductionId()); OnlinePeer::addSelectColumns($criteria); if (!isset($this->lastOnlineCriteria) || !$this->lastOnlineCriteria->equals($criteria)) { $this->collOnlines = OnlinePeer::doSelect($criteria, $con); } } } $this->lastOnlineCriteria = $criteria; return $this->collOnlines; }
/** * Retrieve object using using composite pkey values. * @param int $user_id @param int $production_id * @param Connection $con * @return Online */ public static function retrieveByPK($user_id, $production_id, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(); $criteria->add(OnlinePeer::USER_ID, $user_id); $criteria->add(OnlinePeer::PRODUCTION_ID, $production_id); $v = OnlinePeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }