コード例 #1
0
ファイル: BasesfGuardUser.php プロジェクト: voota/voota
 /**
  * Gets an array of sfGuardUserGroup 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 sfGuardUserGroups 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 sfGuardUserGroup[]
  * @throws     PropelException
  */
 public function getsfGuardUserGroups($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(sfGuardUserPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collsfGuardUserGroups === null) {
         if ($this->isNew()) {
             $this->collsfGuardUserGroups = array();
         } else {
             $criteria->add(sfGuardUserGroupPeer::USER_ID, $this->id);
             sfGuardUserGroupPeer::addSelectColumns($criteria);
             $this->collsfGuardUserGroups = sfGuardUserGroupPeer::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(sfGuardUserGroupPeer::USER_ID, $this->id);
             sfGuardUserGroupPeer::addSelectColumns($criteria);
             if (!isset($this->lastsfGuardUserGroupCriteria) || !$this->lastsfGuardUserGroupCriteria->equals($criteria)) {
                 $this->collsfGuardUserGroups = sfGuardUserGroupPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastsfGuardUserGroupCriteria = $criteria;
     return $this->collsfGuardUserGroups;
 }
コード例 #2
0
ファイル: BasesfGuardUser.php プロジェクト: sgrove/cothinker
 public function getsfGuardUserGroups($criteria = null, $con = null)
 {
     include_once 'plugins/sfGuardPlugin/lib/model/om/BasesfGuardUserGroupPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collsfGuardUserGroups === null) {
         if ($this->isNew()) {
             $this->collsfGuardUserGroups = array();
         } else {
             $criteria->add(sfGuardUserGroupPeer::USER_ID, $this->getId());
             sfGuardUserGroupPeer::addSelectColumns($criteria);
             $this->collsfGuardUserGroups = sfGuardUserGroupPeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(sfGuardUserGroupPeer::USER_ID, $this->getId());
             sfGuardUserGroupPeer::addSelectColumns($criteria);
             if (!isset($this->lastsfGuardUserGroupCriteria) || !$this->lastsfGuardUserGroupCriteria->equals($criteria)) {
                 $this->collsfGuardUserGroups = sfGuardUserGroupPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastsfGuardUserGroupCriteria = $criteria;
     return $this->collsfGuardUserGroups;
 }
コード例 #3
0
 /**
  * Retrieve object using using composite pkey values.
  * @param      string $user_id
  * @param      int $group_id
  * @param      PropelPDO $con
  * @return     sfGuardUserGroup
  */
 public static function retrieveByPK($user_id, $group_id, PropelPDO $con = null)
 {
     $key = serialize(array((string) $user_id, (string) $group_id));
     if (null !== ($obj = sfGuardUserGroupPeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(sfGuardUserGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(sfGuardUserGroupPeer::DATABASE_NAME);
     $criteria->add(sfGuardUserGroupPeer::USER_ID, $user_id);
     $criteria->add(sfGuardUserGroupPeer::GROUP_ID, $group_id);
     $v = sfGuardUserGroupPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
コード例 #4
0
 public static function retrieveByPK($user_id, $group_id, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(sfGuardUserGroupPeer::USER_ID, $user_id);
     $criteria->add(sfGuardUserGroupPeer::GROUP_ID, $group_id);
     $v = sfGuardUserGroupPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }