Commit 5629c45d authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Remplacement par des Factories des closures qui posent problème avec le cache...

Remplacement par des Factories des closures qui posent problème avec le cache de config de Zend s'il est activé
parent 6d5a21cc
Loading
Loading
Loading
Loading
+2 −12
Original line number Diff line number Diff line
@@ -92,12 +92,7 @@ return [

    'controller_plugins' => [
        'factories' => [
            'isAllowed' => function (ContainerInterface $container) {
                /* @var $authorize \BjyAuthorize\Service\Authorize */
                $authorize = $container->get('BjyAuthorize\Service\Authorize');

                return new BjyAuthorize\Controller\Plugin\IsAllowed($authorize);
            }
            'isAllowed' => \BjyAuthorize\Controller\Plugin\IsAllowedFactory::class,
        ],
    ],

@@ -111,12 +106,7 @@ return [

    'view_helpers'    => [
        'factories' => [
            'isAllowed' => function (ContainerInterface $container) {
                /* @var $authorize \BjyAuthorize\Service\Authorize */
                $authorize = $container->get('BjyAuthorize\Service\Authorize');

                return new \BjyAuthorize\View\Helper\IsAllowed($authorize);
            }
            'isAllowed' => \BjyAuthorize\View\Helper\IsAllowedFactory::class,
        ],
    ],

+23 −0
Original line number Diff line number Diff line
<?php

namespace BjyAuthorize\Controller\Plugin;

use Interop\Container\ContainerInterface;

class IsAllowedFactory
{
    /**
     *
     * @param ContainerInterface $container
     *
     * @return IsAllowed
     */
    public function __invoke(ContainerInterface $container, $requestedName, $options = null)
    {
        /* @var $authorize \BjyAuthorize\Service\Authorize */
        $authorize = $container->get('BjyAuthorize\Service\Authorize');

        return new IsAllowed($authorize);
    }

}
 No newline at end of file
+23 −0
Original line number Diff line number Diff line
<?php

namespace BjyAuthorize\View\Helper;

use Interop\Container\ContainerInterface;

class IsAllowedFactory
{
    /**
     *
     * @param ContainerInterface $container
     *
     * @return IsAllowed
     */
    public function __invoke(ContainerInterface $container, $requestedName, $options = null)
    {
        /* @var $authorize \BjyAuthorize\Service\Authorize */
        $authorize = $container->get('BjyAuthorize\Service\Authorize');

        return new IsAllowed($authorize);
    }

}
 No newline at end of file