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\SubtaskEvent;
use SimpleValidator\Validator;
use SimpleValidator\Validators;
@@ -146,7 +147,10 @@ class SubTask extends Base
$subtask_id = $this->persist(self::TABLE, $values);
if ($subtask_id) {
$this->event->trigger(self::EVENT_CREATE, array('id' => $subtask_id) + $values);
$this->container['dispatcher']->dispatch(
self::EVENT_CREATE,
new SubtaskEvent(array('id' => $subtask_id) + $values)
);
}
return $subtask_id;
@@ -165,7 +169,10 @@ class SubTask extends Base
$result = $this->db->table(self::TABLE)->eq('id', $values['id'])->save($values);
if ($result) {
$this->event->trigger(self::EVENT_UPDATE, $values);
$this->container['dispatcher']->dispatch(
self::EVENT_UPDATE,
new SubtaskEvent($values)
);
}
return $result;