Skip to content

Commit a596761

Browse files
Improved some help notes
1 parent ec601b6 commit a596761

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/AppBundle/Controller/BlogController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,17 @@ public function commentNewAction(Request $request, Post $post)
9898
$entityManager->persist($comment);
9999
$entityManager->flush();
100100

101+
// When triggering an event, you can optionally pass some information.
102+
// For simple applications, use the GenericEvent object provided by Symfony
103+
// to pass some PHP variables. For more complex applications, define your
104+
// own event object classes.
101105
// See http://symfony.com/doc/current/components/event_dispatcher/generic_event.html
102106
$event = new GenericEvent($comment);
103107

108+
// When an event is dispatched, Symfony notifies it to all the listeners
109+
// and subscribers registered to it. Listeners can modify the information
110+
// passed in the event and they can even modify the execution flow, so
111+
// there's no guarantee that the rest of this controller will be executed.
104112
// See http://symfony.com/doc/current/components/event_dispatcher.html
105113
$this->get('event_dispatcher')->dispatch(Events::COMMENT_CREATED, $event);
106114

0 commit comments

Comments
 (0)