/** * @param Post $post * @return mixed|void */ public function postPersist($post) { $author = $post->getAuthor(); $username = '******'; if ($author instanceof User) { $username = $author->getUsername(); } $event = new NewPostEvent(); $event->setAuthorUsername($username); $event->setContent($post->getContent()); $this->getEventDispatcher()->dispatch('application_arferr_blog.event.new_post', $event); }
/** * @param NewPostEvent $event */ public function onNewPost(NewPostEvent $event) { //echo 'crmNotifier, onNewPost'; $this->processRequest($event->toArray()); }