Loading module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeForm.php +19 −0 Changes for module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeForm.php: 19 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,14 +3,17 @@ namespace Formation\Form\FormationGroupe; use Application\Form\HasDescription\HasDescriptionFieldset; use Formation\Service\Axe\AxeServiceAwareTrait; use Laminas\Form\Element\Button; use Laminas\Form\Element\Number; use Laminas\Form\Element\Select; use Laminas\Form\Element\Text; use Laminas\Form\Form; use Laminas\InputFilter\Factory; class FormationGroupeForm extends Form { use AxeServiceAwareTrait; public function init(): void { Loading @@ -25,6 +28,21 @@ class FormationGroupeForm extends Form 'id' => 'libelle', ], ]); //axe $this->add([ 'type' => Select::class, 'name' => 'axe', 'options' => [ 'label' => "Axe associé :", 'empty_option' => "Sélectionner un axe ...", 'value_options' => $this->getAxeService()->getAxesAsOptions(), ], 'attributes' => [ 'id' => 'axe', 'class' => 'bootstrap-selectpicker show-tick', 'data-live-search' => 'true', ], ]); //description $this->add([ 'name' => 'HasDescription', Loading Loading @@ -62,6 +80,7 @@ class FormationGroupeForm extends Form //input $this->setInputFilter((new Factory())->createInputFilter([ 'libelle' => ['required' => true,], 'axe' => ['required' => false,], 'description' => ['required' => false,], 'ordre' => ['required' => false,], ])); Loading module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeFormFactory.php +7 −1 Changes for module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeFormFactory.php: 7 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Formation\Form\FormationGroupe; use Formation\Service\Axe\AxeService; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; Loading @@ -17,11 +18,16 @@ class FormationGroupeFormFactory */ public function __invoke(ContainerInterface $container): FormationGroupeForm { /** @var FormationGroupeHydrator $hydrator */ /** * @var AxeService $axeService * @var FormationGroupeHydrator $hydrator **/ $axeService = $container->get(AxeService::class); $hydrator = $container->get('HydratorManager')->get(FormationGroupeHydrator::class); /** @var FormationGroupeForm $form */ $form = new FormationGroupeForm(); $form->setAxeService($axeService); $form->setHydrator($hydrator); return $form; } Loading module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeHydrator.php +7 −4 Changes for module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeHydrator.php: 7 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -3,19 +3,19 @@ namespace Formation\Form\FormationGroupe; use Formation\Entity\Db\FormationGroupe; use Formation\Service\Axe\AxeServiceAwareTrait; use Laminas\Hydrator\HydratorInterface; class FormationGroupeHydrator implements HydratorInterface { use AxeServiceAwareTrait; /** * @param FormationGroupe $object * @return array */ public function extract($object): array { /** @var FormationGroupe $object */ $data = [ 'libelle' => ($object->getLibelle()) ?: null, 'axe' => ($object->getAxe()) ?$object->getAxe()->getLibelle(): null, 'HasDescription' => ['description' => $object->getDescription()], 'ordre' => ($object->getOrdre() !== null) ? $object->getOrdre(): null, ]; Loading @@ -32,8 +32,11 @@ class FormationGroupeHydrator implements HydratorInterface $libelle = (isset($data['libelle']) and trim($data['libelle']) !== '') ? trim($data['libelle']) : null; $description = (isset($data['HasDescription']) AND isset($data['HasDescription']['description']) && trim($data['HasDescription']['description']) != '')?trim($data['HasDescription']['description']):null; $ordre = (isset($data['ordre'])) ? $data['ordre'] : null; $axe = (isset($data['axe'])) ? $this->getAxeService()->getAxe($data['axe']) : null; /** @var FormationGroupe $object */ $object->setLibelle($libelle); $object->setAxe($axe); $object->setDescription($description); $object->setOrdre($ordre?((int) $ordre):null); return $object; Loading module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeHydratorFactory.php +11 −1 Changes for module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeHydratorFactory.php: 11 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,7 +2,10 @@ namespace Formation\Form\FormationGroupe; use Formation\Service\Axe\AxeService; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; class FormationGroupeHydratorFactory { Loading @@ -10,11 +13,18 @@ class FormationGroupeHydratorFactory /** * @param ContainerInterface $container * @return FormationGroupeHydrator * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container): FormationGroupeHydrator { /** @var FormationGroupeHydrator $hydrator */ /** * @var AxeService $axeService */ $axeService = $container->get(AxeService::class); $hydrator = new FormationGroupeHydrator(); $hydrator->setAxeService($axeService); return $hydrator; } } No newline at end of file module/Formation/view/formation/formation-groupe/afficher.phtml +4 −0 Changes for module/Formation/view/formation/formation-groupe/afficher.phtml: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -14,6 +14,10 @@ use Formation\Entity\Db\FormationGroupe; <dl> <dt> Libellé </dt> <dd> <?php echo $groupe->getLibelle(); ?> </dd> <?php if ($groupe->getAxe()) : ?> <dt> Axe </dt> <dd> <?php echo $groupe->getAxe()->getLibelle(); ?> </dd> <?php endif; ?> <dt> Dernière modification </dt> <dd> <?php echo $groupe->getHistoModificateur()->getDisplayName(); ?> Loading Loading
module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeForm.php +19 −0 Changes for module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeForm.php: 19 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,14 +3,17 @@ namespace Formation\Form\FormationGroupe; use Application\Form\HasDescription\HasDescriptionFieldset; use Formation\Service\Axe\AxeServiceAwareTrait; use Laminas\Form\Element\Button; use Laminas\Form\Element\Number; use Laminas\Form\Element\Select; use Laminas\Form\Element\Text; use Laminas\Form\Form; use Laminas\InputFilter\Factory; class FormationGroupeForm extends Form { use AxeServiceAwareTrait; public function init(): void { Loading @@ -25,6 +28,21 @@ class FormationGroupeForm extends Form 'id' => 'libelle', ], ]); //axe $this->add([ 'type' => Select::class, 'name' => 'axe', 'options' => [ 'label' => "Axe associé :", 'empty_option' => "Sélectionner un axe ...", 'value_options' => $this->getAxeService()->getAxesAsOptions(), ], 'attributes' => [ 'id' => 'axe', 'class' => 'bootstrap-selectpicker show-tick', 'data-live-search' => 'true', ], ]); //description $this->add([ 'name' => 'HasDescription', Loading Loading @@ -62,6 +80,7 @@ class FormationGroupeForm extends Form //input $this->setInputFilter((new Factory())->createInputFilter([ 'libelle' => ['required' => true,], 'axe' => ['required' => false,], 'description' => ['required' => false,], 'ordre' => ['required' => false,], ])); Loading
module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeFormFactory.php +7 −1 Changes for module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeFormFactory.php: 7 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Formation\Form\FormationGroupe; use Formation\Service\Axe\AxeService; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; Loading @@ -17,11 +18,16 @@ class FormationGroupeFormFactory */ public function __invoke(ContainerInterface $container): FormationGroupeForm { /** @var FormationGroupeHydrator $hydrator */ /** * @var AxeService $axeService * @var FormationGroupeHydrator $hydrator **/ $axeService = $container->get(AxeService::class); $hydrator = $container->get('HydratorManager')->get(FormationGroupeHydrator::class); /** @var FormationGroupeForm $form */ $form = new FormationGroupeForm(); $form->setAxeService($axeService); $form->setHydrator($hydrator); return $form; } Loading
module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeHydrator.php +7 −4 Changes for module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeHydrator.php: 7 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -3,19 +3,19 @@ namespace Formation\Form\FormationGroupe; use Formation\Entity\Db\FormationGroupe; use Formation\Service\Axe\AxeServiceAwareTrait; use Laminas\Hydrator\HydratorInterface; class FormationGroupeHydrator implements HydratorInterface { use AxeServiceAwareTrait; /** * @param FormationGroupe $object * @return array */ public function extract($object): array { /** @var FormationGroupe $object */ $data = [ 'libelle' => ($object->getLibelle()) ?: null, 'axe' => ($object->getAxe()) ?$object->getAxe()->getLibelle(): null, 'HasDescription' => ['description' => $object->getDescription()], 'ordre' => ($object->getOrdre() !== null) ? $object->getOrdre(): null, ]; Loading @@ -32,8 +32,11 @@ class FormationGroupeHydrator implements HydratorInterface $libelle = (isset($data['libelle']) and trim($data['libelle']) !== '') ? trim($data['libelle']) : null; $description = (isset($data['HasDescription']) AND isset($data['HasDescription']['description']) && trim($data['HasDescription']['description']) != '')?trim($data['HasDescription']['description']):null; $ordre = (isset($data['ordre'])) ? $data['ordre'] : null; $axe = (isset($data['axe'])) ? $this->getAxeService()->getAxe($data['axe']) : null; /** @var FormationGroupe $object */ $object->setLibelle($libelle); $object->setAxe($axe); $object->setDescription($description); $object->setOrdre($ordre?((int) $ordre):null); return $object; Loading
module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeHydratorFactory.php +11 −1 Changes for module/Formation/src/Formation/Form/FormationGroupe/FormationGroupeHydratorFactory.php: 11 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,7 +2,10 @@ namespace Formation\Form\FormationGroupe; use Formation\Service\Axe\AxeService; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; class FormationGroupeHydratorFactory { Loading @@ -10,11 +13,18 @@ class FormationGroupeHydratorFactory /** * @param ContainerInterface $container * @return FormationGroupeHydrator * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container): FormationGroupeHydrator { /** @var FormationGroupeHydrator $hydrator */ /** * @var AxeService $axeService */ $axeService = $container->get(AxeService::class); $hydrator = new FormationGroupeHydrator(); $hydrator->setAxeService($axeService); return $hydrator; } } No newline at end of file
module/Formation/view/formation/formation-groupe/afficher.phtml +4 −0 Changes for module/Formation/view/formation/formation-groupe/afficher.phtml: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -14,6 +14,10 @@ use Formation\Entity\Db\FormationGroupe; <dl> <dt> Libellé </dt> <dd> <?php echo $groupe->getLibelle(); ?> </dd> <?php if ($groupe->getAxe()) : ?> <dt> Axe </dt> <dd> <?php echo $groupe->getAxe()->getLibelle(); ?> </dd> <?php endif; ?> <dt> Dernière modification </dt> <dd> <?php echo $groupe->getHistoModificateur()->getDisplayName(); ?> Loading