Move events handling to Symfony\EventDispatcher

This commit is contained in:
Frédéric Guillot
2014-12-27 19:10:38 -05:00
parent cf821e117c
commit 17dc5bdc9e
75 changed files with 1076 additions and 1167 deletions

View File

@@ -2,6 +2,7 @@
namespace Model;
use Event\CommentEvent;
use SimpleValidator\Validator;
use SimpleValidator\Validators;
@@ -107,7 +108,7 @@ class Comment extends Base
$comment_id = $this->persist(self::TABLE, $values);
if ($comment_id) {
$this->event->trigger(self::EVENT_CREATE, array('id' => $comment_id) + $values);
$this->container['dispatcher']->dispatch(self::EVENT_CREATE, new CommentEvent(array('id' => $comment_id) + $values));
}
return $comment_id;
@@ -127,7 +128,7 @@ class Comment extends Base
->eq('id', $values['id'])
->update(array('comment' => $values['comment']));
$this->event->trigger(self::EVENT_UPDATE, $values);
$this->container['dispatcher']->dispatch(self::EVENT_UPDATE, new CommentEvent($values));
return $result;
}