Loading module/Mission/config/module.config.php +12 −2 Changes for module/Mission/config/module.config.php: 12 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -99,8 +99,18 @@ return [ 'action' => 'index', 'may_terminate' => true, 'child_routes' => [ ] ] 'saisir' => [ 'route' => '/saisir[/:typeMission]', 'controller' => MissionTypeController::class, 'action' => 'saisir', ], 'supprimer' => [ 'route' => '/supprimer/:typeMission', 'controller' => MissionTypeController::class, 'action' => 'supprimer', ], ], ], ], Loading module/Mission/src/Controller/MissionTypeController.php +15 −10 Changes for module/Mission/src/Controller/MissionTypeController.php: 15 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ namespace Mission\Controller; use Application\Controller\AbstractController; use Mission\Entity\Db\TypeMission; use Mission\Form\MissionTypeFormAwareTrait; use Mission\Form\MissionTypeValeurFormAwareTrait; use Mission\Service\MissionTypeServiceAwareTrait; use Application\Service\Traits\ContextServiceAwareTrait; use UnicaenApp\View\Model\MessengerViewModel; Loading @@ -18,14 +18,16 @@ class MissionTypeController extends AbstractController { use MissionTypeServiceAwareTrait; use ContextServiceAwareTrait; // use MissionTypeFormAwareTrait; use MissionTypeFormAwareTrait; public function indexAction() { $this->em()->getFilters()->enable('annee')->init([ TypeMission::class, ]); $missionsType = $this->getServiceMissionType()->getTypes(); $typeMissions = $this->getServiceMissionType()->getTypes(); return compact('typeMissions'); return compact('missionsType'); } Loading @@ -33,16 +35,16 @@ class MissionTypeController extends AbstractController public function saisirAction() { $type = $this->getEvent()->getParam('typeMission'); $typeMission = $this->getEvent()->getParam('typeMission'); $form = $this->getFormMissionType(); if (empty($type)) { if (empty($typeMission)) { $title = "Création d'un nouveau type"; $type = $this->getServiceMissionType()->newEntity(); $typeMission = $this->getServiceMissionType()->newEntity(); } else { $title = "Édition d'un type"; } $form->bindRequestSave($type, $this->getRequest(), function () use ($type, $form) { $this->getServiceMissionTaux()->save($type); $form->bindRequestSave($typeMission, $this->getRequest(), function () use ($typeMission, $form) { $this->getServiceMissionType()->save($typeMission); $this->flashMessenger()->addSuccessMessage( "Ajout réussi" Loading @@ -51,6 +53,9 @@ class MissionTypeController extends AbstractController return compact('form', 'title'); } public function supprimerAction(): MessengerViewModel { $type = $this->getEvent()->getParam('typeMission'); Loading module/Mission/src/Entity/Db/TypeMission.php +2 −2 Changes for module/Mission/src/Entity/Db/TypeMission.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ class TypeMission implements ParametreEntityInterface public function setCode(?string $code): MissionTauxRemu public function setCode(?string $code): TypeMission { $this->code = $code; Loading @@ -49,7 +49,7 @@ class TypeMission implements ParametreEntityInterface public function setLibelle(?string $libelle): MissionTauxRemu public function setLibelle(?string $libelle): TypeMission { $this->libelle = $libelle; Loading module/Mission/src/Form/MissionTypeForm.php 0 → 100644 +37 −0 Changes for module/Mission/src/Form/MissionTypeForm.php: 37 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mission\Form; use Application\Form\AbstractForm; use Laminas\Form\FormInterface; use Mission\Entity\Db\TypeMission; use Mission\Service\MissionTauxServiceAwareTrait; use UnicaenImport\Service\Traits\SchemaServiceAwareTrait; class MissionTypeForm extends AbstractForm { use SchemaServiceAwareTrait; use MissionTauxServiceAwareTrait; public function init() { $ignore = []; $this->spec(TypeMission::class, $ignore); $this->build(); $this->setValueOptions('missionTauxRemu', $this->getServiceMissionTaux()->getTauxRemus()); $this->addSecurity(); $this->addSubmit(); return $this; } public function bind($object, $flags = FormInterface::VALUES_NORMALIZED) { /* @var $object TypeMission */ parent::bind($object, $flags); return $this; } } module/Mission/src/Form/MissionTypeFormAwareTrait.php 0 → 100755 +39 −0 Changes for module/Mission/src/Form/MissionTypeFormAwareTrait.php: 39 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mission\Form; /** * Description of MissionTauxFormAwareTrait * * @author UnicaenCode */ trait MissionTypeFormAwareTrait { protected ?MissionTypeForm $formMissionType = null; /** * @param MissionTypeForm $formMissionType * * @return self */ public function setFormMissionType(?MissionTauxForm $formMissionType) { $this->formMissionType = $formMissionType; return $this; } public function getFormMissionType(): ?MissionTypeForm { if (!empty($this->formMissionType)) { return $this->formMissionType; } return \Application::$container->get('FormElementManager')->get(MissionTypeForm::class); } } No newline at end of file Loading
module/Mission/config/module.config.php +12 −2 Changes for module/Mission/config/module.config.php: 12 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -99,8 +99,18 @@ return [ 'action' => 'index', 'may_terminate' => true, 'child_routes' => [ ] ] 'saisir' => [ 'route' => '/saisir[/:typeMission]', 'controller' => MissionTypeController::class, 'action' => 'saisir', ], 'supprimer' => [ 'route' => '/supprimer/:typeMission', 'controller' => MissionTypeController::class, 'action' => 'supprimer', ], ], ], ], Loading
module/Mission/src/Controller/MissionTypeController.php +15 −10 Changes for module/Mission/src/Controller/MissionTypeController.php: 15 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ namespace Mission\Controller; use Application\Controller\AbstractController; use Mission\Entity\Db\TypeMission; use Mission\Form\MissionTypeFormAwareTrait; use Mission\Form\MissionTypeValeurFormAwareTrait; use Mission\Service\MissionTypeServiceAwareTrait; use Application\Service\Traits\ContextServiceAwareTrait; use UnicaenApp\View\Model\MessengerViewModel; Loading @@ -18,14 +18,16 @@ class MissionTypeController extends AbstractController { use MissionTypeServiceAwareTrait; use ContextServiceAwareTrait; // use MissionTypeFormAwareTrait; use MissionTypeFormAwareTrait; public function indexAction() { $this->em()->getFilters()->enable('annee')->init([ TypeMission::class, ]); $missionsType = $this->getServiceMissionType()->getTypes(); $typeMissions = $this->getServiceMissionType()->getTypes(); return compact('typeMissions'); return compact('missionsType'); } Loading @@ -33,16 +35,16 @@ class MissionTypeController extends AbstractController public function saisirAction() { $type = $this->getEvent()->getParam('typeMission'); $typeMission = $this->getEvent()->getParam('typeMission'); $form = $this->getFormMissionType(); if (empty($type)) { if (empty($typeMission)) { $title = "Création d'un nouveau type"; $type = $this->getServiceMissionType()->newEntity(); $typeMission = $this->getServiceMissionType()->newEntity(); } else { $title = "Édition d'un type"; } $form->bindRequestSave($type, $this->getRequest(), function () use ($type, $form) { $this->getServiceMissionTaux()->save($type); $form->bindRequestSave($typeMission, $this->getRequest(), function () use ($typeMission, $form) { $this->getServiceMissionType()->save($typeMission); $this->flashMessenger()->addSuccessMessage( "Ajout réussi" Loading @@ -51,6 +53,9 @@ class MissionTypeController extends AbstractController return compact('form', 'title'); } public function supprimerAction(): MessengerViewModel { $type = $this->getEvent()->getParam('typeMission'); Loading
module/Mission/src/Entity/Db/TypeMission.php +2 −2 Changes for module/Mission/src/Entity/Db/TypeMission.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ class TypeMission implements ParametreEntityInterface public function setCode(?string $code): MissionTauxRemu public function setCode(?string $code): TypeMission { $this->code = $code; Loading @@ -49,7 +49,7 @@ class TypeMission implements ParametreEntityInterface public function setLibelle(?string $libelle): MissionTauxRemu public function setLibelle(?string $libelle): TypeMission { $this->libelle = $libelle; Loading
module/Mission/src/Form/MissionTypeForm.php 0 → 100644 +37 −0 Changes for module/Mission/src/Form/MissionTypeForm.php: 37 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mission\Form; use Application\Form\AbstractForm; use Laminas\Form\FormInterface; use Mission\Entity\Db\TypeMission; use Mission\Service\MissionTauxServiceAwareTrait; use UnicaenImport\Service\Traits\SchemaServiceAwareTrait; class MissionTypeForm extends AbstractForm { use SchemaServiceAwareTrait; use MissionTauxServiceAwareTrait; public function init() { $ignore = []; $this->spec(TypeMission::class, $ignore); $this->build(); $this->setValueOptions('missionTauxRemu', $this->getServiceMissionTaux()->getTauxRemus()); $this->addSecurity(); $this->addSubmit(); return $this; } public function bind($object, $flags = FormInterface::VALUES_NORMALIZED) { /* @var $object TypeMission */ parent::bind($object, $flags); return $this; } }
module/Mission/src/Form/MissionTypeFormAwareTrait.php 0 → 100755 +39 −0 Changes for module/Mission/src/Form/MissionTypeFormAwareTrait.php: 39 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mission\Form; /** * Description of MissionTauxFormAwareTrait * * @author UnicaenCode */ trait MissionTypeFormAwareTrait { protected ?MissionTypeForm $formMissionType = null; /** * @param MissionTypeForm $formMissionType * * @return self */ public function setFormMissionType(?MissionTauxForm $formMissionType) { $this->formMissionType = $formMissionType; return $this; } public function getFormMissionType(): ?MissionTypeForm { if (!empty($this->formMissionType)) { return $this->formMissionType; } return \Application::$container->get('FormElementManager')->get(MissionTypeForm::class); } } No newline at end of file