public static function retrieveByProjectId($project_id) { $owner_object = sfSimpleForumOwnerPeer::retrieveByModelId('project', $project_id); if ($owner_object != null) { return self::retrieveByOwnerId($owner_object->getId()); } return null; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = sfSimpleForumOwnerPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setUuid($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setTitle($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setSlug($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setModel($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setModelId($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setStandalone($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setCreatedAt($arr[$keys[7]]); } }
public function getForumCategories() { $categories = sfSimpleForumCategoryPeer::retrieveByProjectId($this->getId()); if ($categories == null) { $owner_object = sfSimpleForumOwnerPeer::retrieveByModelId('project', $this->getId()); if ($owner_object == null) { $owner_object = new sfSimpleForumOwner(); $owner_object->setModel('project'); $owner_object->setModelId($this->getId()); $owner_object->setTitle($this->getTitle() . ' Forum Categories'); $owner_object->save(); } $category = new sfSimpleForumCategory(); $category->setName($this->getTitle() . ' Default'); $category->setDescription('Default forum for project ' . $this->getTitle()); $category->setOwnerId($owner_object->getId()); $category->save(); $forum = $category->newForum('Default ' . $this->getTitle() . ' Forum', 'A general forum for discussing anything related to the project "' . $this->getTitle() . '"'); return $owner_object->getCategories(); } return $categories; }
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(sfSimpleForumOwnerPeer::ID, $pks, Criteria::IN); $objs = sfSimpleForumOwnerPeer::doSelect($criteria, $con); } return $objs; }
public function getsfSimpleForumOwner($con = null) { if ($this->asfSimpleForumOwner === null && $this->owner_id !== null) { include_once 'lib/model/om/BasesfSimpleForumOwnerPeer.php'; $this->asfSimpleForumOwner = sfSimpleForumOwnerPeer::retrieveByPK($this->owner_id, $con); } return $this->asfSimpleForumOwner; }
public static function doSelectJoinAll(Criteria $c, $con = null) { foreach (sfMixer::getCallables('BasesfSimpleForumCategoryPeer:doSelectJoinAll:doSelectJoinAll') as $callable) { call_user_func($callable, 'BasesfSimpleForumCategoryPeer', $c, $con); } $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } sfSimpleForumCategoryPeer::addSelectColumns($c); $startcol2 = sfSimpleForumCategoryPeer::NUM_COLUMNS - sfSimpleForumCategoryPeer::NUM_LAZY_LOAD_COLUMNS + 1; sfSimpleForumOwnerPeer::addSelectColumns($c); $startcol3 = $startcol2 + sfSimpleForumOwnerPeer::NUM_COLUMNS; $c->addJoin(sfSimpleForumCategoryPeer::OWNER_ID, sfSimpleForumOwnerPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = sfSimpleForumCategoryPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = sfSimpleForumOwnerPeer::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->getsfSimpleForumOwner(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addsfSimpleForumCategory($obj1); break; } } if ($newObject) { $obj2->initsfSimpleForumCategorys(); $obj2->addsfSimpleForumCategory($obj1); } $results[] = $obj1; } return $results; }