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,8 @@
namespace Model;
use Event\FileEvent;
/**
* File model
*
@@ -89,7 +91,10 @@ class File extends Base
*/
public function create($task_id, $name, $path, $is_image)
{
$this->event->trigger(self::EVENT_CREATE, array('task_id' => $task_id, 'name' => $name));
$this->container['dispatcher']->dispatch(
self::EVENT_CREATE,
new FileEvent(array('task_id' => $task_id, 'name' => $name))
);
return $this->db->table(self::TABLE)->save(array(
'task_id' => $task_id,