Skip to content
Snippets Groups Projects
Select Git revision
  • f40a5f90e3112a08479dafb7729f85bddd145f8c
  • master default protected
  • 5.x
  • ll-php8-bs5
  • release_5_bs5
  • ll-php8
  • 4.x
  • laminas_migration
  • release_1.0.0.2
  • release_4.0.0
  • release_3.2.8
  • bootstrap4_migration
  • 1.0.0.3
  • 6.0.7
  • 6.0.6
  • 6.0.5
  • 6.0.4
  • 6.0.3
  • 6.0.2
  • 6.0.1
  • 5.1.1
  • 6.0.0
  • 5.1.0
  • 5.0.0
  • 4.0.2
  • 3.2.11
  • 4.0.1
  • 3.2.10
  • 4.0.0
  • 1.0.0.2
  • 3.2.9
  • 3.2.8
32 results

Module.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    FormulaireControllerFactory.php 2.76 KiB
    <?php
    
    namespace UnicaenAutoform\Controller;
    
    use Psr\Container\ContainerExceptionInterface;
    use Psr\Container\ContainerInterface;
    use Psr\Container\NotFoundExceptionInterface;
    use UnicaenAutoform\Form\Categorie\CategorieForm;
    use UnicaenAutoform\Form\Champ\ChampForm;
    use UnicaenAutoform\Form\Formulaire\FormulaireForm;
    use UnicaenAutoform\Form\MotClef\MotClefForm;
    use UnicaenAutoform\Service\Categorie\CategorieService;
    use UnicaenAutoform\Service\Champ\ChampService;
    use UnicaenAutoform\Service\Formulaire\FormulaireInstanceService;
    use UnicaenAutoform\Service\Formulaire\FormulaireReponseService;
    use UnicaenAutoform\Service\Formulaire\FormulaireService;
    
    class FormulaireControllerFactory
    {
    
        /**
         * @param ContainerInterface $container
         * @return FormulaireController
         * @throws ContainerExceptionInterface
         * @throws NotFoundExceptionInterface
         */
        public function __invoke(ContainerInterface $container): FormulaireController
        {
            /**
             * @var CategorieService $categorieService
             * @var ChampService $champService
             * @var FormulaireService $formulaireService
             * @var FormulaireReponseService $formulaireReponseService
             * @var FormulaireInstanceService $formulaireInstanceService
             */
            $categorieService = $container->get(CategorieService::class);
            $champService = $container->get(ChampService::class);
            $formulaireService = $container->get(FormulaireService::class);
            $formulaireReponseService = $container->get(FormulaireReponseService::class);
            $formulaireInstanceService = $container->get(FormulaireInstanceService::class);
    
            /**
             * @var CategorieForm $categorieForm
             * @var ChampForm $champForm
             * @var FormulaireForm $formulaireForm
             * @var MotClefForm $motClefForm
             */
            $categorieForm = $container->get('FormElementManager')->get(CategorieForm::class);
            $champForm = $container->get('FormElementManager')->get(ChampForm::class);
            $formulaireForm = $container->get('FormElementManager')->get(FormulaireForm::class);
            $motClefForm = $container->get('FormElementManager')->get(MotClefForm::class);
    
            $controller = new FormulaireController();
            $controller->setCategorieService($categorieService);
            $controller->setChampService($champService);
            $controller->setFormulaireService($formulaireService);
            $controller->setFormulaireReponseService($formulaireReponseService);
            $controller->setFormulaireInstanceService($formulaireInstanceService);
            $controller->setCategorieForm($categorieForm);
            $controller->setChampForm($champForm);
            $controller->setFormulaireForm($formulaireForm);
            $controller->setMotClefForm($motClefForm);
            return $controller;
        }
    }