Loading module/Application/src/Application/Form/CentreCout/CentreCoutStructureSaisieForm.php +0 −22 Original line number Diff line number Diff line Loading @@ -51,22 +51,6 @@ class CentreCoutStructureSaisieForm extends AbstractForm ->setEmptyOption("(Aucun)") ->setValueOptions(\UnicaenApp\Util::collectionAsOptions($this->getStructures())); $this->add([ 'name' => 'code', 'options' => [ 'label' => "Code", ], 'type' => 'Text', ]); $this->add([ 'name' => 'code', 'options' => [ 'label' => "Code", ], 'type' => 'Text', ]); $this->add([ 'name' => 'unite-budgetaire', 'options' => [ Loading Loading @@ -118,9 +102,6 @@ class CentreCoutStructureSaisieForm extends AbstractForm 'required' => false, ], 'source-code' => [ 'required' => false, ], ]; } Loading Loading @@ -151,9 +132,7 @@ class CentreCoutStructureHydrator implements HydratorInterface if (array_key_exists('structure', $data)) { $object->setStructure($this->getServiceStructure()->get($data['structure'])); } $object->setSourceCode($data['code']); $object->setCentreCout($this->getServiceCentreCout()->get($data['centre-cout'])); $object->setSource($this->getServiceSource()->getOse()); $object->setUniteBudgetaire($data['unite-budgetaire']); return $object; Loading @@ -173,7 +152,6 @@ class CentreCoutStructureHydrator implements HydratorInterface $data = [ 'id' => $object->getId(), 'structure' => ($s = $object->getStructure()) ? $s->getId() : null, 'code' => $object->getSourceCode(), 'centre-cout' => $object->getCentreCout()->getId(), 'unite-budgetaire' => $object->getUniteBudgetaire(), ]; Loading module/Application/src/Application/Service/CentreCoutStructureService.php +29 −1 Original line number Diff line number Diff line Loading @@ -2,11 +2,18 @@ namespace Application\Service; use Application\Entity\Db\CentreCoutStructure; use Application\Service\Traits\SourceServiceAwareTrait; /** * Description of TypeCentreCoutStructure */ class CentreCoutStructureService extends AbstractEntityService { use SourceServiceAwareTrait; /** * retourne la classe des entités * Loading @@ -15,9 +22,11 @@ class CentreCoutStructureService extends AbstractEntityService */ public function getEntityClass() { return \Application\Entity\Db\CentreCoutStructure::class; return CentreCoutStructure::class; } /** * Retourne l'alias d'entité courante * Loading @@ -28,4 +37,23 @@ class CentreCoutStructureService extends AbstractEntityService return 'ccs'; } /** * @param CentreCoutStructure $entity * * @return CentreCoutStructure */ public function save($entity) { if (!$entity->getSource()) { $entity->setSource($this->getServiceSource()->getOse()); } if (!$entity->getSourceCode()) { $entity->setSourceCode(uniqid('CCS_OSE_')); } return parent::save($entity); // TODO: Change the autogenerated stub } } Loading
module/Application/src/Application/Form/CentreCout/CentreCoutStructureSaisieForm.php +0 −22 Original line number Diff line number Diff line Loading @@ -51,22 +51,6 @@ class CentreCoutStructureSaisieForm extends AbstractForm ->setEmptyOption("(Aucun)") ->setValueOptions(\UnicaenApp\Util::collectionAsOptions($this->getStructures())); $this->add([ 'name' => 'code', 'options' => [ 'label' => "Code", ], 'type' => 'Text', ]); $this->add([ 'name' => 'code', 'options' => [ 'label' => "Code", ], 'type' => 'Text', ]); $this->add([ 'name' => 'unite-budgetaire', 'options' => [ Loading Loading @@ -118,9 +102,6 @@ class CentreCoutStructureSaisieForm extends AbstractForm 'required' => false, ], 'source-code' => [ 'required' => false, ], ]; } Loading Loading @@ -151,9 +132,7 @@ class CentreCoutStructureHydrator implements HydratorInterface if (array_key_exists('structure', $data)) { $object->setStructure($this->getServiceStructure()->get($data['structure'])); } $object->setSourceCode($data['code']); $object->setCentreCout($this->getServiceCentreCout()->get($data['centre-cout'])); $object->setSource($this->getServiceSource()->getOse()); $object->setUniteBudgetaire($data['unite-budgetaire']); return $object; Loading @@ -173,7 +152,6 @@ class CentreCoutStructureHydrator implements HydratorInterface $data = [ 'id' => $object->getId(), 'structure' => ($s = $object->getStructure()) ? $s->getId() : null, 'code' => $object->getSourceCode(), 'centre-cout' => $object->getCentreCout()->getId(), 'unite-budgetaire' => $object->getUniteBudgetaire(), ]; Loading
module/Application/src/Application/Service/CentreCoutStructureService.php +29 −1 Original line number Diff line number Diff line Loading @@ -2,11 +2,18 @@ namespace Application\Service; use Application\Entity\Db\CentreCoutStructure; use Application\Service\Traits\SourceServiceAwareTrait; /** * Description of TypeCentreCoutStructure */ class CentreCoutStructureService extends AbstractEntityService { use SourceServiceAwareTrait; /** * retourne la classe des entités * Loading @@ -15,9 +22,11 @@ class CentreCoutStructureService extends AbstractEntityService */ public function getEntityClass() { return \Application\Entity\Db\CentreCoutStructure::class; return CentreCoutStructure::class; } /** * Retourne l'alias d'entité courante * Loading @@ -28,4 +37,23 @@ class CentreCoutStructureService extends AbstractEntityService return 'ccs'; } /** * @param CentreCoutStructure $entity * * @return CentreCoutStructure */ public function save($entity) { if (!$entity->getSource()) { $entity->setSource($this->getServiceSource()->getOse()); } if (!$entity->getSourceCode()) { $entity->setSourceCode(uniqid('CCS_OSE_')); } return parent::save($entity); // TODO: Change the autogenerated stub } }