You need to sign in or sign up before continuing.
Select Git revision
instantiate.pp
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
IndicateurControllerFactory.php 1.54 KiB
<?php
namespace UnicaenIndicateur\Controller;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use UnicaenIndicateur\Form\Indicateur\IndicateurForm;
use UnicaenIndicateur\Service\Abonnement\AbonnementService;
use UnicaenIndicateur\Service\Indicateur\IndicateurService;
use Interop\Container\ContainerInterface;
use UnicaenUtilisateur\Service\User\UserService;;
class IndicateurControllerFactory {
/**
* @param ContainerInterface $container
* @return IndicateurController
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function __invoke(ContainerInterface $container) : IndicateurController
{
/**
* @var AbonnementService $abonnementService
* @var IndicateurService $indicateurService
* @var UserService $userService
*/
$abonnementService = $container->get(AbonnementService::class);
$indicateurService = $container->get(IndicateurService::class);
$userService = $container->get(UserService::class);
/**
* @var IndicateurForm $indicateurForm
*/
$indicateurForm = $container->get('FormElementManager')->get(IndicateurForm::class);
$controller = new IndicateurController();
$controller->setAbonnementService($abonnementService);
$controller->setIndicateurService($indicateurService);
$controller->setUserService($userService);
$controller->setIndicateurForm($indicateurForm);
return $controller;
}
}