示例#1
0
 public static function doSelectJoinAll(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     SmsPbPeer::addSelectColumns($c);
     $startcol2 = SmsPbPeer::NUM_COLUMNS - SmsPbPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     SmsPbGroupPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + SmsPbGroupPeer::NUM_COLUMNS;
     $c->addJoin(SmsPbPeer::GROUP_ID, SmsPbGroupPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = SmsPbPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = SmsPbGroupPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getSmsPbGroup();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addSmsPb($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initSmsPbs();
             $obj2->addSmsPb($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
示例#2
0
 public function getSmsPbs($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseSmsPbPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collSmsPbs === null) {
         if ($this->isNew()) {
             $this->collSmsPbs = array();
         } else {
             $criteria->add(SmsPbPeer::GROUP_ID, $this->getId());
             SmsPbPeer::addSelectColumns($criteria);
             $this->collSmsPbs = SmsPbPeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(SmsPbPeer::GROUP_ID, $this->getId());
             SmsPbPeer::addSelectColumns($criteria);
             if (!isset($this->lastSmsPbCriteria) || !$this->lastSmsPbCriteria->equals($criteria)) {
                 $this->collSmsPbs = SmsPbPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastSmsPbCriteria = $criteria;
     return $this->collSmsPbs;
 }