diff options
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/Action.php | 2 | ||||
-rw-r--r-- | app/Model/Authentication.php | 6 | ||||
-rw-r--r-- | app/Model/Base.php | 20 | ||||
-rw-r--r-- | app/Model/Notification.php | 7 | ||||
-rw-r--r-- | app/Model/Project.php | 2 | ||||
-rw-r--r-- | app/Model/ProjectActivity.php | 2 | ||||
-rw-r--r-- | app/Model/Webhook.php | 4 |
7 files changed, 21 insertions, 22 deletions
diff --git a/app/Model/Action.php b/app/Model/Action.php index c3acdc5b..f8dbd88e 100644 --- a/app/Model/Action.php +++ b/app/Model/Action.php @@ -264,7 +264,7 @@ class Action extends Base public function load($name, $project_id, $event) { $className = '\Action\\'.$name; - return new $className($this->registry, $project_id, $event); + return new $className($this->container, $project_id, $event); } /** diff --git a/app/Model/Authentication.php b/app/Model/Authentication.php index b9ebcfe2..a0e9684f 100644 --- a/app/Model/Authentication.php +++ b/app/Model/Authentication.php @@ -24,12 +24,12 @@ class Authentication extends Base */ public function backend($name) { - if (! isset($this->registry->$name)) { + if (! isset($this->container[$name])) { $class = '\Auth\\'.ucfirst($name); - $this->registry->$name = new $class($this->registry); + $this->container[$name] = new $class($this->container); } - return $this->registry->shared($name); + return $this->container[$name]; } /** diff --git a/app/Model/Base.php b/app/Model/Base.php index 72d91c3c..5a8d8f1c 100644 --- a/app/Model/Base.php +++ b/app/Model/Base.php @@ -4,7 +4,7 @@ namespace Model; use Core\Event; use Core\Tool; -use Core\Registry; +use Pimple\Container; use PicoDb\Database; /** @@ -58,24 +58,24 @@ abstract class Base public $event; /** - * Registry instance + * Container instance * * @access protected - * @var \Core\Registry + * @var Pimple\Container */ - protected $registry; + protected $container; /** * Constructor * * @access public - * @param \Core\Registry $registry Registry instance + * @param Pimple\Container $container */ - public function __construct(Registry $registry) + public function __construct(Container $container) { - $this->registry = $registry; - $this->db = $this->registry->shared('db'); - $this->event = $this->registry->shared('event'); + $this->container = $container; + $this->db = $this->container['db']; + $this->event = $this->container['event']; } /** @@ -87,7 +87,7 @@ abstract class Base */ public function __get($name) { - return Tool::loadModel($this->registry, $name); + return Tool::loadModel($this->container, $name); } /** diff --git a/app/Model/Notification.php b/app/Model/Notification.php index d2fcf525..32765041 100644 --- a/app/Model/Notification.php +++ b/app/Model/Notification.php @@ -117,7 +117,7 @@ class Notification extends Base foreach ($events as $event_name => $template_name) { - $listener = new NotificationListener($this->registry); + $listener = new NotificationListener($this->container); $listener->setTemplate($template_name); $this->event->attach($event_name, $listener); @@ -135,8 +135,7 @@ class Notification extends Base public function sendEmails($template, array $users, array $data) { try { - $transport = $this->registry->shared('mailer'); - $mailer = Swift_Mailer::newInstance($transport); + $mailer = Swift_Mailer::newInstance($this->container['mailer']); $message = Swift_Message::newInstance() ->setSubject($this->getMailSubject($template, $data)) @@ -149,7 +148,7 @@ class Notification extends Base } } catch (Swift_TransportException $e) { - debug($e->getMessage()); + $this->container['logger']->addError($e->getMessage()); } } diff --git a/app/Model/Project.php b/app/Model/Project.php index 305e3f1e..2abee2aa 100644 --- a/app/Model/Project.php +++ b/app/Model/Project.php @@ -546,7 +546,7 @@ class Project extends Base GithubWebhook::EVENT_COMMIT, ); - $listener = new ProjectModificationDateListener($this->registry); + $listener = new ProjectModificationDateListener($this->container); foreach ($events as $event_name) { $this->event->attach($event_name, $listener); diff --git a/app/Model/ProjectActivity.php b/app/Model/ProjectActivity.php index 6d6ef454..9d7ecfac 100644 --- a/app/Model/ProjectActivity.php +++ b/app/Model/ProjectActivity.php @@ -147,7 +147,7 @@ class ProjectActivity extends Base SubTask::EVENT_CREATE, ); - $listener = new ProjectActivityListener($this->registry); + $listener = new ProjectActivityListener($this->container); foreach ($events as $event_name) { $this->event->attach($event_name, $listener); diff --git a/app/Model/Webhook.php b/app/Model/Webhook.php index b84728cf..14d50684 100644 --- a/app/Model/Webhook.php +++ b/app/Model/Webhook.php @@ -93,7 +93,7 @@ class Webhook extends Base Task::EVENT_ASSIGNEE_CHANGE, ); - $listener = new WebhookListener($this->registry); + $listener = new WebhookListener($this->container); $listener->setUrl($this->url_task_modification); foreach ($events as $event_name) { @@ -108,7 +108,7 @@ class Webhook extends Base */ public function attachCreateEvents() { - $listener = new WebhookListener($this->registry); + $listener = new WebhookListener($this->container); $listener->setUrl($this->url_task_creation); $this->event->attach(Task::EVENT_CREATE, $listener); |