Пример #1
0
 public function getTemplateRecords($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseTemplateRecordPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collTemplateRecords === null) {
         if ($this->isNew()) {
             $this->collTemplateRecords = array();
         } else {
             $criteria->add(TemplateRecordPeer::TEMPLATE_ID, $this->getId());
             TemplateRecordPeer::addSelectColumns($criteria);
             $this->collTemplateRecords = TemplateRecordPeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(TemplateRecordPeer::TEMPLATE_ID, $this->getId());
             TemplateRecordPeer::addSelectColumns($criteria);
             if (!isset($this->lastTemplateRecordCriteria) || !$this->lastTemplateRecordCriteria->equals($criteria)) {
                 $this->collTemplateRecords = TemplateRecordPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastTemplateRecordCriteria = $criteria;
     return $this->collTemplateRecords;
 }
 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(TemplateRecordPeer::ID, $pks, Criteria::IN);
         $objs = TemplateRecordPeer::doSelect($criteria, $con);
     }
     return $objs;
 }