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 function addsfSimpleForumCategory(sfSimpleForumCategory $l) { $this->collsfSimpleForumCategorys[] = $l; $l->setsfSimpleForumOwner($this); }
include $sf_path . '/test/bootstrap/functional.php'; // create a new test browser $browser = new sfTestBrowser(); $browser->initialize(); // initialize database manager $databaseManager = new sfDatabaseManager(); $databaseManager->initialize(); $con = Propel::getConnection(); // cleanup database sfSimpleForumCategoryPeer::doDeleteAll(); sfSimpleForumForumPeer::doDeleteAll(); sfSimpleForumPostPeer::doDeleteAll(); // Now we can start to test $t = new lime_test(34, new lime_output_color()); // Initialization $cat = new sfSimpleForumCategory(); $cat->save(); $forum = new sfSimpleForumForum(); $forum->setCategoryId($cat->getId()); $forum->save(); $topic = new sfSimpleForumTopic(); $topic->setTitle('This is a test'); $topic->setsfSimpleForumForum($forum); $topic->save(); $user0 = new sfGuardUser(); $user0->setUsername('me'); $user0->setPassword('me'); $user0->save(); $user1 = new sfGuardUser(); $user1->setUsername('foo'); $user1->setPassword('foo');