public function processCommentForm(Form $form, $values) { $this->comment = $this->comments->createEntity(); $user = $this->users->getByID($this->getUser()->getId()); $this->comment->setMessage($values->message); $this->comment->setArticle($this->article); $this->comment->setUser($user); $this->comments->persist($this->comment); $this->redirect('this'); }
public function updateModifiedField(Event $event, Comment $entity) { if ($entity->dirty('text') && !$entity->isNew()) { $entity->modified = new Time(); } }