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 CommunityEventComment(); $comment->setMemberId($this->member->getId()); $comment->setCommunityEventId($request['community_event_id']); $this->forward400If(false === $comment->getCommunityEvent()->isCreatableCommunityEventComment($this->member->getId()), 'you are not allowed to create comments on this event'); $comment->setBody($request['body']); $comment->save(); $this->comment = $comment; }