public function addsfSimpleForumTopic(sfSimpleForumTopic $l) { $this->collsfSimpleForumTopics[] = $l; $l->setsfSimpleForumForum($this); }
$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'); $user1->save(); $user2 = new sfGuardUser(); $user2->setUsername('bar'); $user2->setPassword('bar'); $user2->save(); $user3 = new sfGuardUser(); $user3->setUsername('baz');
public function executeAddTopic() { $forum = sfSimpleForumForumPeer::retrieveByStrippedName($this->getRequestParameter('forum_name')); $this->forward404Unless($forum); $topic = new sfSimpleForumTopic(); $topic->setsfSimpleForumForum($forum); $topic->setTitle($this->getRequestParameter('title')); $topic->setUserId(sfSimpleForumTools::getConnectedUserId()); if ($this->getUser()->hasCredential('moderator')) { $topic->setIsSticked($this->getRequestParameter('is_sticked', 0)); $topic->setIsLocked($this->getRequestParameter('is_locked', 0)); } $topic->save(); $post = new sfSimpleForumPost(); $post->setContent($this->getRequestParameter('body')); $post->setUserId(sfSimpleForumTools::getConnectedUserId()); $post->setsfSimpleForumTopic($topic); $post->save(); $this->redirectToPost($post); }