Loading module/Application/src/Application/Controller/StatutIntervenantController.php +10 −6 Changes for module/Application/src/Application/Controller/StatutIntervenantController.php: 10 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -7,9 +7,11 @@ use Application\Entity\Db\StatutIntervenant; use Application\Provider\Privilege\Privileges; use Application\Form\StatutIntervenant\Traits\StatutIntervenantSaisieFormAwareTrait; use Application\Provider\Role\RoleProvider; use Application\Provider\Role\RoleProviderAwareTrait; use Application\Service\Traits\StatutIntervenantServiceAwareTrait; use UnicaenApp\View\Model\MessengerViewModel; use Application\Service\Traits\TypeIntervenantServiceAwareTrait; use UnicaenAuth\Service\Traits\RoleServiceAwareTrait; use Zend\View\Model\ViewModel; class StatutIntervenantController extends AbstractController Loading @@ -18,8 +20,7 @@ class StatutIntervenantController extends AbstractController use StatutIntervenantSaisieFormAwareTrait; use TypeIntervenantServiceAwareTrait; use CacheContainerTrait; use RoleProviderAwareTrait; public function indexAction() { Loading Loading @@ -59,7 +60,9 @@ class StatutIntervenantController extends AbstractController $form->bindRequestSave($statutIntervenant, $this->getRequest(), function (StatutIntervenant $si) { try { $this->getServiceStatutIntervenant()->save($si); //Unset cache statutsInfo et Regénére le cache unset($this->getCacheContainer(RoleProvider::class)->statutsInfo); $this->getProviderRole()->getStatutsInfo(); $this->flashMessenger()->addSuccessMessage('Enregistrement effectué'); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); Loading @@ -69,10 +72,8 @@ class StatutIntervenantController extends AbstractController $form->bind($statutIntervenant); $form->readOnly(); } } catch(\Exception $e) { var_dump($e); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } Loading @@ -93,7 +94,9 @@ class StatutIntervenantController extends AbstractController $form->bindRequestSave($newStatutIntervenant, $this->getRequest(), function (StatutIntervenant $si) { try { $this->getServiceStatutIntervenant()->save($si); //unset uniquement si cache statusInfo existe unset($this->getCacheContainer(RoleProvider::class)->statutsInfo); $this->getProviderRole()->getStatutsInfo(); $this->flashMessenger()->addSuccessMessage('Duplication effectuée'); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); Loading Loading @@ -124,6 +127,7 @@ class StatutIntervenantController extends AbstractController try { $this->getServiceStatutIntervenant()->delete($statutIntervenant); unset($this->getCacheContainer(RoleProvider::class)->statutsInfo); $this->getProviderRole()->getStatutsInfo(); $this->flashMessenger()->addSuccessMessage("Statut d'Intervenant supprimé avec succès."); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); Loading module/Application/src/Application/Provider/Role/RoleProviderAwareTrait.php +x+41 Changes for module/Application/src/Application/Provider/Role/RoleProviderAwareTrait.php: 41 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Application\Provider\Role; trait RoleProviderAwareTrait { /** * @var RoleProvider */ private $providerRole; /** * @param RoleProvider $providerRole * * @return self */ public function setProviderRole(RoleProvider $providerRole) { $this->providerRole = $providerRole; return $this; } /** * @return RoleProvider */ public function getProviderRole() { if (!$this->providerRole) { $this->providerRole = \Application::$container->get(RoleProvider::class); } return $this->providerRole; } } No newline at end of file Loading
module/Application/src/Application/Controller/StatutIntervenantController.php +10 −6 Changes for module/Application/src/Application/Controller/StatutIntervenantController.php: 10 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -7,9 +7,11 @@ use Application\Entity\Db\StatutIntervenant; use Application\Provider\Privilege\Privileges; use Application\Form\StatutIntervenant\Traits\StatutIntervenantSaisieFormAwareTrait; use Application\Provider\Role\RoleProvider; use Application\Provider\Role\RoleProviderAwareTrait; use Application\Service\Traits\StatutIntervenantServiceAwareTrait; use UnicaenApp\View\Model\MessengerViewModel; use Application\Service\Traits\TypeIntervenantServiceAwareTrait; use UnicaenAuth\Service\Traits\RoleServiceAwareTrait; use Zend\View\Model\ViewModel; class StatutIntervenantController extends AbstractController Loading @@ -18,8 +20,7 @@ class StatutIntervenantController extends AbstractController use StatutIntervenantSaisieFormAwareTrait; use TypeIntervenantServiceAwareTrait; use CacheContainerTrait; use RoleProviderAwareTrait; public function indexAction() { Loading Loading @@ -59,7 +60,9 @@ class StatutIntervenantController extends AbstractController $form->bindRequestSave($statutIntervenant, $this->getRequest(), function (StatutIntervenant $si) { try { $this->getServiceStatutIntervenant()->save($si); //Unset cache statutsInfo et Regénére le cache unset($this->getCacheContainer(RoleProvider::class)->statutsInfo); $this->getProviderRole()->getStatutsInfo(); $this->flashMessenger()->addSuccessMessage('Enregistrement effectué'); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); Loading @@ -69,10 +72,8 @@ class StatutIntervenantController extends AbstractController $form->bind($statutIntervenant); $form->readOnly(); } } catch(\Exception $e) { var_dump($e); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } Loading @@ -93,7 +94,9 @@ class StatutIntervenantController extends AbstractController $form->bindRequestSave($newStatutIntervenant, $this->getRequest(), function (StatutIntervenant $si) { try { $this->getServiceStatutIntervenant()->save($si); //unset uniquement si cache statusInfo existe unset($this->getCacheContainer(RoleProvider::class)->statutsInfo); $this->getProviderRole()->getStatutsInfo(); $this->flashMessenger()->addSuccessMessage('Duplication effectuée'); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); Loading Loading @@ -124,6 +127,7 @@ class StatutIntervenantController extends AbstractController try { $this->getServiceStatutIntervenant()->delete($statutIntervenant); unset($this->getCacheContainer(RoleProvider::class)->statutsInfo); $this->getProviderRole()->getStatutsInfo(); $this->flashMessenger()->addSuccessMessage("Statut d'Intervenant supprimé avec succès."); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); Loading
module/Application/src/Application/Provider/Role/RoleProviderAwareTrait.php +x+41 Changes for module/Application/src/Application/Provider/Role/RoleProviderAwareTrait.php: 41 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Application\Provider\Role; trait RoleProviderAwareTrait { /** * @var RoleProvider */ private $providerRole; /** * @param RoleProvider $providerRole * * @return self */ public function setProviderRole(RoleProvider $providerRole) { $this->providerRole = $providerRole; return $this; } /** * @return RoleProvider */ public function getProviderRole() { if (!$this->providerRole) { $this->providerRole = \Application::$container->get(RoleProvider::class); } return $this->providerRole; } } No newline at end of file