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;
 }
Example #2
0
 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;
 }