diff --git a/lib/Alchemy/Phrasea/Controller/Admin/DashboardController.php b/lib/Alchemy/Phrasea/Controller/Admin/DashboardController.php index 325f76a3ac..b3f34cb254 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/DashboardController.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/DashboardController.php @@ -10,7 +10,7 @@ namespace Alchemy\Phrasea\Controller\Admin; -use Alchemy\Phrasea\Application; +use Alchemy\Phrasea\Application\Helper\NotifierAware; use Alchemy\Phrasea\Authentication\Authenticator; use Alchemy\Phrasea\Cache\Cache; use Alchemy\Phrasea\Controller\Controller; @@ -19,7 +19,6 @@ use Alchemy\Phrasea\Exception\RuntimeException; use Alchemy\Phrasea\Model\Manipulator\ACLManipulator; use Alchemy\Phrasea\Model\Manipulator\UserManipulator; use Alchemy\Phrasea\Model\Repositories\UserRepository; -use Alchemy\Phrasea\Notification\Deliverer; use Alchemy\Phrasea\Notification\Mail\MailTest; use Alchemy\Phrasea\Notification\Receiver; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -27,6 +26,8 @@ use Symfony\Component\HttpFoundation\Request; class DashboardController extends Controller { + use NotifierAware; + /** * Display admin dashboard page * @@ -89,9 +90,7 @@ class DashboardController extends Controller $mail = MailTest::create($this->app, $receiver); - /** @var Deliverer $deliverer */ - $deliverer = $this->app['notification.deliverer']; - $deliverer->deliver($mail); + $this->deliver($mail); /** @var \Swift_SpoolTransport $spoolTransport */ $spoolTransport = $this->app['swiftmailer.spooltransport']; diff --git a/lib/Alchemy/Phrasea/Controller/Admin/UserController.php b/lib/Alchemy/Phrasea/Controller/Admin/UserController.php index b00602e6b8..1f96c9d45d 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/UserController.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/UserController.php @@ -10,6 +10,7 @@ namespace Alchemy\Phrasea\Controller\Admin; +use Alchemy\Phrasea\Application\Helper\NotifierAware; use Alchemy\Phrasea\Controller\Controller; use Alchemy\Phrasea\Core\Response\CSVFileResponse; use Alchemy\Phrasea\Helper\User as UserHelper; @@ -20,7 +21,6 @@ use Alchemy\Phrasea\Model\Manipulator\UserManipulator; use Alchemy\Phrasea\Model\NativeQueryProvider; use Alchemy\Phrasea\Model\Repositories\RegistrationRepository; use Alchemy\Phrasea\Model\Repositories\UserRepository; -use Alchemy\Phrasea\Notification\Deliverer; use Alchemy\Phrasea\Notification\Mail\MailSuccessEmailUpdate; use Alchemy\Phrasea\Notification\Receiver; use Goodby\CSV\Export\Protocol\ExporterInterface; @@ -30,6 +30,8 @@ use Symfony\Component\HttpFoundation\Response; class UserController extends Controller { + use NotifierAware; + public function editRightsAction(Request $request) { $rights = $this->getUserEditHelper($request); @@ -507,9 +509,7 @@ class UserController extends Controller $receiver = new Receiver(null, $user->getEmail()); $mail = MailSuccessEmailUpdate::create($this->app, $receiver, null, $message); - /** @var Deliverer $deliverer */ - $deliverer = $this->app['notification.deliverer']; - $deliverer->deliver($mail); + $this->deliver($mail); } } } diff --git a/lib/Alchemy/Phrasea/ControllerProvider/Admin/Dashboard.php b/lib/Alchemy/Phrasea/ControllerProvider/Admin/Dashboard.php index 700a4833b5..90eb56ae23 100644 --- a/lib/Alchemy/Phrasea/ControllerProvider/Admin/Dashboard.php +++ b/lib/Alchemy/Phrasea/ControllerProvider/Admin/Dashboard.php @@ -23,7 +23,10 @@ class Dashboard implements ControllerProviderInterface, ServiceProviderInterface public function register(Application $app) { $app['controller.admin.dashboard'] = $app->share(function (PhraseaApplication $app) { - return new DashboardController($app); + return (new DashboardController($app)) + ->setDelivererLocator(function () use ($app) { + return $app['notification.deliverer']; + }); }); } diff --git a/lib/Alchemy/Phrasea/ControllerProvider/Admin/Users.php b/lib/Alchemy/Phrasea/ControllerProvider/Admin/Users.php index 2500007575..ba726cf7e4 100644 --- a/lib/Alchemy/Phrasea/ControllerProvider/Admin/Users.php +++ b/lib/Alchemy/Phrasea/ControllerProvider/Admin/Users.php @@ -24,7 +24,10 @@ class Users implements ControllerProviderInterface, ServiceProviderInterface public function register(Application $app) { $app['controller.admin.users'] = $app->share(function () use ($app) { - return new UserController($app); + return (new UserController($app)) + ->setDelivererLocator(function () use ($app) { + return $app['notification.deliverer']; + }); }); }