/** * Gets an array of sfGuardRememberKey objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this sfGuardUser has previously been saved, it will retrieve * related sfGuardRememberKeys from storage. If this sfGuardUser is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array sfGuardRememberKey[] * @throws PropelException */ public function getsfGuardRememberKeys($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(sfGuardUserPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collsfGuardRememberKeys === null) { if ($this->isNew()) { $this->collsfGuardRememberKeys = array(); } else { $criteria->add(sfGuardRememberKeyPeer::USER_ID, $this->id); sfGuardRememberKeyPeer::addSelectColumns($criteria); $this->collsfGuardRememberKeys = sfGuardRememberKeyPeer::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(sfGuardRememberKeyPeer::USER_ID, $this->id); sfGuardRememberKeyPeer::addSelectColumns($criteria); if (!isset($this->lastsfGuardRememberKeyCriteria) || !$this->lastsfGuardRememberKeyCriteria->equals($criteria)) { $this->collsfGuardRememberKeys = sfGuardRememberKeyPeer::doSelect($criteria, $con); } } } $this->lastsfGuardRememberKeyCriteria = $criteria; return $this->collsfGuardRememberKeys; }
/** * Retrieve object using using composite pkey values. * @param int $user_id * @param string $ip_address * @param PropelPDO $con * @return sfGuardRememberKey */ public static function retrieveByPK($user_id, $ip_address, PropelPDO $con = null) { $_instancePoolKey = serialize(array((string) $user_id, (string) $ip_address)); if (null !== ($obj = sfGuardRememberKeyPeer::getInstanceFromPool($_instancePoolKey))) { return $obj; } if ($con === null) { $con = Propel::getConnection(sfGuardRememberKeyPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $criteria = new Criteria(sfGuardRememberKeyPeer::DATABASE_NAME); $criteria->add(sfGuardRememberKeyPeer::USER_ID, $user_id); $criteria->add(sfGuardRememberKeyPeer::IP_ADDRESS, $ip_address); $v = sfGuardRememberKeyPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }
public static function retrieveByPK($user_id, $ip_address, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(); $criteria->add(sfGuardRememberKeyPeer::USER_ID, $user_id); $criteria->add(sfGuardRememberKeyPeer::IP_ADDRESS, $ip_address); $v = sfGuardRememberKeyPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }
public function getsfGuardRememberKeys($criteria = null, $con = null) { include_once 'plugins/sfGuardPlugin/lib/model/om/BasesfGuardRememberKeyPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collsfGuardRememberKeys === null) { if ($this->isNew()) { $this->collsfGuardRememberKeys = array(); } else { $criteria->add(sfGuardRememberKeyPeer::USER_ID, $this->getId()); sfGuardRememberKeyPeer::addSelectColumns($criteria); $this->collsfGuardRememberKeys = sfGuardRememberKeyPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(sfGuardRememberKeyPeer::USER_ID, $this->getId()); sfGuardRememberKeyPeer::addSelectColumns($criteria); if (!isset($this->lastsfGuardRememberKeyCriteria) || !$this->lastsfGuardRememberKeyCriteria->equals($criteria)) { $this->collsfGuardRememberKeys = sfGuardRememberKeyPeer::doSelect($criteria, $con); } } } $this->lastsfGuardRememberKeyCriteria = $criteria; return $this->collsfGuardRememberKeys; }