From d0b45011d216d4c1debf77bf39f33e146a4750ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20L=C3=A9cluse?= <laurent.lecluse@unicaen.fr> Date: Fri, 19 Feb 2016 14:47:24 +0000 Subject: [PATCH] =?UTF-8?q?Acc=C3=A8s=20au=20flashMessengher=20depuis=20le?= =?UTF-8?q?s=20assertions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assertion/AbstractAssertion.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/UnicaenAuth/Assertion/AbstractAssertion.php b/src/UnicaenAuth/Assertion/AbstractAssertion.php index ff15a5e..8b26645 100644 --- a/src/UnicaenAuth/Assertion/AbstractAssertion.php +++ b/src/UnicaenAuth/Assertion/AbstractAssertion.php @@ -5,6 +5,7 @@ namespace UnicaenAuth\Assertion; use BjyAuthorize\Service\Authorize; use UnicaenAuth\Service\Traits\UserContextServiceAwareTrait; use Zend\Mvc\Application; +use Zend\Mvc\Controller\Plugin\FlashMessenger; use Zend\Mvc\MvcEvent; use Zend\Permissions\Acl\Acl; use Zend\Permissions\Acl\Assertion\AssertionInterface; @@ -33,6 +34,11 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw */ private $role = false; + /** + * @var FlashMessenger + */ + private $fm; + /** @@ -293,4 +299,17 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw return $serviceAuthorize; } + + + /** + * @return FlashMessenger + */ + protected function flashMessenger() + { + if (!$this->fm){ + $this->fm = $this->getServiceLocator()->get('controllerpluginmanager')->get('flashmessenger'); + } + + return $this->fm; + } } \ No newline at end of file -- GitLab