public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } SmOutgoingPeer::addSelectColumns($c); $startcol2 = SmOutgoingPeer::NUM_COLUMNS - SmOutgoingPeer::NUM_LAZY_LOAD_COLUMNS + 1; SmIncomingPeer::addSelectColumns($c); $startcol3 = $startcol2 + SmIncomingPeer::NUM_COLUMNS; $c->addJoin(SmOutgoingPeer::SM_INCOMING_ID, SmIncomingPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = SmOutgoingPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = SmIncomingPeer::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->getSmIncoming(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addSmOutgoing($obj1); break; } } if ($newObject) { $obj2->initSmOutgoings(); $obj2->addSmOutgoing($obj1); } $results[] = $obj1; } return $results; }
public function getSmIncoming($con = null) { include_once 'lib/model/om/BaseSmIncomingPeer.php'; if ($this->aSmIncoming === null && $this->sm_incoming_id !== null) { $this->aSmIncoming = SmIncomingPeer::retrieveByPK($this->sm_incoming_id, $con); } return $this->aSmIncoming; }
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(SmIncomingPeer::ID, $pks, Criteria::IN); $objs = SmIncomingPeer::doSelect($criteria, $con); } return $objs; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = SmIncomingPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setIncomingDate($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setTrxId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setTrxDate($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setMsisdn($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setSms($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setOperator($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setSc($arr[$keys[7]]); } }
public function executeDelete() { $sm_incoming = SmIncomingPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($sm_incoming); $ref_error = 0; foreach ($sm_incoming->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $sm_incoming->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('sm_incoming/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('sm_incoming/delete', '_ERR_DELETE_ (' . $sm_incoming->toString() . ' - id:' . $sm_incoming->getId() . ')'); } else { $sm_incoming->delete(); } return $this->forward('sm_incoming', 'list'); }