Commit 863e09ab authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Agrement view helper factory

parent c4142a96
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
namespace Agrement;

use Agrement\Assertion\AgrementAssertion;
use Agrement\Assertion\AgrementAssertionFactory;
use Agrement\Controller\AgrementController;
use Agrement\Controller\Factory\AgrementControllerFactory;
use Agrement\Entity\Db\TypeAgrement;
@@ -15,6 +14,7 @@ use Agrement\Service\TblAgrementService;
use Agrement\Service\TblAgrementServiceFactory;
use Agrement\Service\TypeAgrementService;
use Agrement\Service\TypeAgrementServiceFactory;
use Agrement\View\Helper\AgrementVewHelperFactory;
use Agrement\View\Helper\AgrementViewHelper;
use Application\Provider\Privilege\Privileges;
use UnicaenAuth\Assertion\AssertionFactory;
@@ -239,7 +239,7 @@ return [

    ],
    'view_helpers' => [
        'agrement' => AgrementViewHelper::class,
        'agrement' => AgrementVewHelperFactory::class,
    ],

    'forms' => [
+31 −0
Original line number Diff line number Diff line
<?php

namespace Agrement\View\Helper;

use Psr\Container\ContainerInterface;


/**
 * Description of AgrementVewHelperFactory
 *
 * @author Laurent Lécluse <laurent.lecluse at unicaen.fr>
 */
class AgrementVewHelperFactory
{

    /**
     * @param ContainerInterface $container
     * @param string             $requestedName
     * @param array|null         $options
     *
     * @return AgrementViewHelper
     */
    public function __invoke(ContainerInterface $container, $requestedName, $options = null): AgrementViewHelper
    {
        $viewHelper = new AgrementViewHelper();

        /* Injectez vos dépendances ICI */

        return $viewHelper;
    }
}
 No newline at end of file
+3 −3
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

namespace Agrement\View\Helper;

use Agrement\Entity\Db\Agrement as Entity;
use Agrement\Entity\Db\Agrement;
use Agrement\Entity\Db\TblAgrement;
use Agrement\Entity\Db\Traits\AgrementAwareTrait;
use Application\Constants;
@@ -33,11 +33,11 @@ class AgrementViewHelper extends AbstractHtmlElement

    /**
     *
     * @param Entity $agrement
     * @param Agrement $agrement
     *
     * @return self
     */
    public function __invoke(Entity $agrement = null, TblAgrement $tblAgrement = null)
    public function __invoke(Agrement $agrement = null, TblAgrement $tblAgrement = null)
    {
        if ($agrement) $this->setAgrement($agrement);
        if ($tblAgrement) $this->setTblAgrement($tblAgrement);