Loading module/Mission/config/module.config.php +2 Changes for module/Mission/config/module.config.php: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -104,9 +104,11 @@ return [ 'services' => [ Assertion\MissionAssertion::class => \UnicaenAuth\Assertion\AssertionFactory::class, Service\MissionService::class => Service\MissionServiceFactory::class, ], 'forms' => [ Form\MissionForm::class => Form\MissionFormFactory::class, ], 'view_helpers' => [ Loading module/Mission/src/Controller/MissionController.php +21 −1 Changes for module/Mission/src/Controller/MissionController.php: 21 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -4,6 +4,9 @@ namespace Mission\Controller; use Application\Controller\AbstractController; use Application\Entity\Db\Intervenant; use Mission\Entity\Db\Mission; use Mission\Form\MissionFormAwareTrait; use Mission\Service\MissionServiceAwareTrait; /** Loading @@ -13,6 +16,9 @@ use Application\Entity\Db\Intervenant; */ class MissionController extends AbstractController { use MissionServiceAwareTrait; use MissionFormAwareTrait; public function indexAction() { Loading @@ -20,7 +26,21 @@ class MissionController extends AbstractController $intervenant = $this->getEvent()->getParam('intervenant'); return compact('intervenant'); $missionForm = $this->getFormMission(); $dql = "SELECT m FROM " . Mission::class . " m WHERE m.histoDestruction IS NULL AND m.intervenant = :intervenant"; /* @var $missions Mission[] */ $missions = $this->em()->createQuery($dql)->setParameters([ 'intervenant' => $intervenant, ])->getResult(); $result = []; foreach ($missions as $k => $mission) { $missions[$k] = $missionForm->getHydrator()->extract($mission); } return compact('intervenant', 'missions', 'missionForm'); } } No newline at end of file module/Mission/src/Form/MissionForm.php +x+44 Changes for module/Mission/src/Form/MissionForm.php: 44 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mission\Form; use Application\Entity\Db\Structure; use Application\Form\AbstractForm; use Mission\Entity\Db\Mission; use Mission\Entity\Db\MissionTauxRemu; use Mission\Entity\Db\TypeMission; /** * Description of MissionForm * * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> */ class MissionForm extends AbstractForm { public function init() { $this->setAttribute('action', $this->getCurrentUrl()); $this->spec(Mission::class, ['intervenant']); $this->build(); $this->setValueOptions('typeMission', "SELECT tm FROM " . TypeMission::class . " tm WHERE tm.histoDestruction IS NULL"); $this->setValueOptions('missionTauxRemu', "SELECT mtr FROM " . MissionTauxRemu::class . " mtr"); $this->setValueOptions('structure', "SELECT s FROM " . Structure::class . " s WHERE s.histoDestruction IS NULL"); $this->setLabels([ 'typeMission' => '', 'missionTauxRemu' => 'Taux de rémunération', 'dateDebut' => '', 'dateFin' => '', 'description' => 'Descriptif de la mission', 'autoValidation' => 'La mission n\'a pas besoin d\'être validée', 'structure' => 'Composante en charge du suivi de mission', ]); $this->addSubmit(); } } No newline at end of file module/Mission/src/Form/MissionFormAwareTrait.php +x+39 Changes for module/Mission/src/Form/MissionFormAwareTrait.php: 39 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mission\Form; /** * Description of MissionFormAwareTrait * * @author UnicaenCode */ trait MissionFormAwareTrait { protected ?MissionForm $formMission = null; /** * @param MissionForm $formMission * * @return self */ public function setFormMission(?MissionForm $formMission) { $this->formMission = $formMission; return $this; } public function getFormMission(): ?MissionForm { if (!empty($this->formMission)) { return $this->formMission; } return \Application::$container->get('FormElementManager')->get(MissionForm::class); } } No newline at end of file module/Mission/src/Form/MissionFormFactory.php +x+32 Changes for module/Mission/src/Form/MissionFormFactory.php: 32 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mission\Form; use Psr\Container\ContainerInterface; /** * Description of MissionFormFactory * * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> */ class MissionFormFactory { /** * @param ContainerInterface $container * @param string $requestedName * @param array|null $options * * @return MissionForm */ public function __invoke(ContainerInterface $container, $requestedName, $options = null): MissionForm { $form = new MissionForm; /* Injectez vos dépendances ICI */ return $form; } } No newline at end of file Loading
module/Mission/config/module.config.php +2 Changes for module/Mission/config/module.config.php: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -104,9 +104,11 @@ return [ 'services' => [ Assertion\MissionAssertion::class => \UnicaenAuth\Assertion\AssertionFactory::class, Service\MissionService::class => Service\MissionServiceFactory::class, ], 'forms' => [ Form\MissionForm::class => Form\MissionFormFactory::class, ], 'view_helpers' => [ Loading
module/Mission/src/Controller/MissionController.php +21 −1 Changes for module/Mission/src/Controller/MissionController.php: 21 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -4,6 +4,9 @@ namespace Mission\Controller; use Application\Controller\AbstractController; use Application\Entity\Db\Intervenant; use Mission\Entity\Db\Mission; use Mission\Form\MissionFormAwareTrait; use Mission\Service\MissionServiceAwareTrait; /** Loading @@ -13,6 +16,9 @@ use Application\Entity\Db\Intervenant; */ class MissionController extends AbstractController { use MissionServiceAwareTrait; use MissionFormAwareTrait; public function indexAction() { Loading @@ -20,7 +26,21 @@ class MissionController extends AbstractController $intervenant = $this->getEvent()->getParam('intervenant'); return compact('intervenant'); $missionForm = $this->getFormMission(); $dql = "SELECT m FROM " . Mission::class . " m WHERE m.histoDestruction IS NULL AND m.intervenant = :intervenant"; /* @var $missions Mission[] */ $missions = $this->em()->createQuery($dql)->setParameters([ 'intervenant' => $intervenant, ])->getResult(); $result = []; foreach ($missions as $k => $mission) { $missions[$k] = $missionForm->getHydrator()->extract($mission); } return compact('intervenant', 'missions', 'missionForm'); } } No newline at end of file
module/Mission/src/Form/MissionForm.php +x+44 Changes for module/Mission/src/Form/MissionForm.php: 44 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mission\Form; use Application\Entity\Db\Structure; use Application\Form\AbstractForm; use Mission\Entity\Db\Mission; use Mission\Entity\Db\MissionTauxRemu; use Mission\Entity\Db\TypeMission; /** * Description of MissionForm * * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> */ class MissionForm extends AbstractForm { public function init() { $this->setAttribute('action', $this->getCurrentUrl()); $this->spec(Mission::class, ['intervenant']); $this->build(); $this->setValueOptions('typeMission', "SELECT tm FROM " . TypeMission::class . " tm WHERE tm.histoDestruction IS NULL"); $this->setValueOptions('missionTauxRemu', "SELECT mtr FROM " . MissionTauxRemu::class . " mtr"); $this->setValueOptions('structure', "SELECT s FROM " . Structure::class . " s WHERE s.histoDestruction IS NULL"); $this->setLabels([ 'typeMission' => '', 'missionTauxRemu' => 'Taux de rémunération', 'dateDebut' => '', 'dateFin' => '', 'description' => 'Descriptif de la mission', 'autoValidation' => 'La mission n\'a pas besoin d\'être validée', 'structure' => 'Composante en charge du suivi de mission', ]); $this->addSubmit(); } } No newline at end of file
module/Mission/src/Form/MissionFormAwareTrait.php +x+39 Changes for module/Mission/src/Form/MissionFormAwareTrait.php: 39 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mission\Form; /** * Description of MissionFormAwareTrait * * @author UnicaenCode */ trait MissionFormAwareTrait { protected ?MissionForm $formMission = null; /** * @param MissionForm $formMission * * @return self */ public function setFormMission(?MissionForm $formMission) { $this->formMission = $formMission; return $this; } public function getFormMission(): ?MissionForm { if (!empty($this->formMission)) { return $this->formMission; } return \Application::$container->get('FormElementManager')->get(MissionForm::class); } } No newline at end of file
module/Mission/src/Form/MissionFormFactory.php +x+32 Changes for module/Mission/src/Form/MissionFormFactory.php: 32 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mission\Form; use Psr\Container\ContainerInterface; /** * Description of MissionFormFactory * * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> */ class MissionFormFactory { /** * @param ContainerInterface $container * @param string $requestedName * @param array|null $options * * @return MissionForm */ public function __invoke(ContainerInterface $container, $requestedName, $options = null): MissionForm { $form = new MissionForm; /* Injectez vos dépendances ICI */ return $form; } } No newline at end of file