public static function doSelectJoinAllExceptDepartment(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } CirRegulationPeer::addSelectColumns($c); $startcol2 = CirRegulationPeer::NUM_COLUMNS - CirRegulationPeer::NUM_LAZY_LOAD_COLUMNS + 1; MemberTypePeer::addSelectColumns($c); $startcol3 = $startcol2 + MemberTypePeer::NUM_COLUMNS; CatCategoryPeer::addSelectColumns($c); $startcol4 = $startcol3 + CatCategoryPeer::NUM_COLUMNS; $c->addJoin(CirRegulationPeer::MEMBER_TYPE_ID, MemberTypePeer::ID); $c->addJoin(CirRegulationPeer::CAT_CATEGORY_ID, CatCategoryPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = CirRegulationPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = MemberTypePeer::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->getMemberType(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addCirRegulation($obj1); break; } } if ($newObject) { $obj2->initCirRegulations(); $obj2->addCirRegulation($obj1); } $omClass = CatCategoryPeer::getOMClass(); $cls = Propel::import($omClass); $obj3 = new $cls(); $obj3->hydrate($rs, $startcol3); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj3 = $temp_obj1->getCatCategory(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addCirRegulation($obj1); break; } } if ($newObject) { $obj3->initCirRegulations(); $obj3->addCirRegulation($obj1); } $results[] = $obj1; } return $results; }
public function executeDelete() { $member_type = MemberTypePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($member_type); $ref_error = 0; foreach ($member_type->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $member_type->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('member_type/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('member_type/delete', '_ERR_DELETE_ (' . $member_type->toString() . ' - id:' . $member_type->getId() . ')'); } else { $member_type->delete(); } return $this->forward('member_type', 'list'); }
public function getType($criteria = null, $con = null) { $c = new Criteria(); $c->add(MemberTypePeer::ID, 1); return MemberTypePeer::doSelect($c); }
public function getMemberType($con = null) { include_once 'lib/model/om/BaseMemberTypePeer.php'; if ($this->aMemberType === null && $this->member_type_id !== null) { $this->aMemberType = MemberTypePeer::retrieveByPK($this->member_type_id, $con); } return $this->aMemberType; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = MemberTypePeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setMemberTemplateId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setCode($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setDescription($arr[$keys[3]]); } }
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(MemberTypePeer::ID, $pks, Criteria::IN); $objs = MemberTypePeer::doSelect($criteria, $con); } return $objs; }
public function countMemberTypes($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseMemberTypePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(MemberTypePeer::MEMBER_TEMPLATE_ID, $this->getId()); return MemberTypePeer::doCount($criteria, $distinct, $con); }