public function executePost(sfWebRequest $request) { $this->forward400If('' === (string) $request['body'], 'body parameter is not specified.'); if ($limit = sfConfig::get('app_smt_comment_post_limit')) { $this->forward400If(mb_strlen($request['body']) > $limit, 'body parameter is too long'); } $comment = new CommunityTopicComment(); $comment->setMemberId($this->member->getId()); $comment->setCommunityTopicId($request['community_topic_id']); $this->forward400If(false === $comment->getCommunityTopic()->isCreatableCommunityTopicComment($this->member->getId()), 'you are not allowed to create comments on this topic'); $comment->setBody($request['body']); $comment->save(); $this->comment = $comment; }