예제 #1
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(MagPeer::ID, $pks, Criteria::IN);
         $objs = MagPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
예제 #2
0
 public function getMags($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseMagPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collMags === null) {
         if ($this->isNew()) {
             $this->collMags = array();
         } else {
             $criteria->add(MagPeer::USER_ID, $this->getId());
             MagPeer::addSelectColumns($criteria);
             $this->collMags = MagPeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(MagPeer::USER_ID, $this->getId());
             MagPeer::addSelectColumns($criteria);
             if (!isset($this->lastMagCriteria) || !$this->lastMagCriteria->equals($criteria)) {
                 $this->collMags = MagPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastMagCriteria = $criteria;
     return $this->collMags;
 }