Loading code/test6.php +14 −9 Changes for code/test6.php: 14 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -5,19 +5,24 @@ * @var $container \Psr\Container\ContainerInterface */ use Formule\Model\FormuleDetailsExtractor; $em = $container->get(\Doctrine\ORM\EntityManager::class); $fts = $container->get(\Formule\Service\TestService::class); $fs = $container->get(\Formule\Service\FormuleService::class); //2023/2024 - DALMASSO Marion $fi = $fs->getFormuleServiceIntervenant(783665, 1, 1); $intervenantId = 783665; $typeVolumeHoraireId = 1; $etatVolumeHoraireId = 1; $intervenant = $em->find(\Intervenant\Entity\Db\Intervenant::class, $intervenantId); $typeVolumeHoraire = $em->find(\Service\Entity\Db\TypeVolumeHoraire::class, $typeVolumeHoraireId); $etatVolumeHoraire = $em->find(\Service\Entity\Db\EtatVolumeHoraire::class, $etatVolumeHoraireId); if (null == $fi->getArrondisseurTrace()) { $fs->calculer($fi); } $trace = $fi->getArrondisseurTrace(); $vu = $trace->getValeursUtilisees(); $ft = $fts->creerDepuisIntervenant($intervenant, $typeVolumeHoraire, $etatVolumeHoraire); var_dump($vu); No newline at end of file var_dump($ft); No newline at end of file module/Application/src/Hydrator/GenericHydrator.php +2 −2 Changes for module/Application/src/Hydrator/GenericHydrator.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -29,11 +29,11 @@ class GenericHydrator implements HydratorInterface public function __construct(EntityManager $entityManager, string|object|array $spec = []) public function __construct(EntityManager $entityManager, string|object|array $spec = [], array $ignore = []) { $this->setEntityManager($entityManager); if (!empty($spec)) { $this->spec($spec); $this->spec($spec, $ignore); } } Loading module/Formule/src/Service/TestService.php +31 −27 Changes for module/Formule/src/Service/TestService.php: 31 added lines, 27 removed lines. Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Formule\Service; use Application\Hydrator\GenericHydrator; use Application\Service\AbstractEntityService; use Application\Service\Traits\ParametresServiceAwareTrait; use Formule\Entity\FormuleVolumeHoraire; use RuntimeException; use Formule\Entity\Db\Formule; use Formule\Entity\Db\FormuleTestIntervenant; Loading Loading @@ -74,38 +75,41 @@ class TestService extends AbstractEntityService public function creerDepuisIntervenant(Intervenant $intervenant, TypeVolumeHoraire $typeVolumeHoraire, EtatVolumeHoraire $etatVolumeHoraire): FormuleTestIntervenant { $conn = $this->getEntityManager()->getConnection(); $fsi = $this->getServiceFormule()->getFormuleServiceIntervenant($intervenant, $typeVolumeHoraire, $etatVolumeHoraire); $formule = $this->getServiceFormule()->getCurrent(); $intervenantQuery = trim($conn->executeQuery('SELECT ' . $formule->getCode() . '.INTERVENANT_QUERY Q FROM DUAL')->fetchOne()); $volumeHoraireQuery = trim($conn->executeQuery('SELECT ' . $formule->getCode() . '.VOLUME_HORAIRE_QUERY Q FROM DUAL')->fetchOne()); $fti = new FormuleTestIntervenant(); $sql = "BEGIN ose_formule.intervenant.id := " . $intervenant->getId() . "; END;"; $conn->executeStatement($sql); $hydrator = new GenericHydrator($this->getEntityManager(), $fsi); $hydrator->setExtractType($hydrator::EXTRACT_TYPE_ORIGINAL); $params = ['intervenant' => $intervenant->getId()]; $data = $hydrator->extract($fsi); $idata = $conn->fetchAllAssociative('SELECT * FROM (' . $intervenantQuery . ') q WHERE intervenant_id = :intervenant', $params)[0]; $params['typeVolumeHoraire'] = $typeVolumeHoraire->getId(); $params['etatVolumeHoraire'] = $etatVolumeHoraire->getId(); $vhdata = $conn->fetchAllAssociative('SELECT * FROM (' . $volumeHoraireQuery . ') q WHERE intervenant_id = :intervenant AND type_volume_horaire_id = :typeVolumeHoraire AND etat_volume_horaire_id >= :etatVolumeHoraire', $params); unset($data['id']); $hydrator->hydrate($data, $fti); $taux = []; $vhIgnore = ['id','formuleIntervenant', 'tauxServiceDu', 'tauxServiceCompl']; $vhHydrator = new GenericHydrator($this->getEntityManager(), FormuleVolumeHoraire::class, $vhIgnore); foreach( $fsi->getVolumesHoraires() as $vh){ $taux[$vh->getTypeInterventionCode()] = [ 'serviceDu' => $vh->getTauxServiceDu(), 'serviceCompl' => $vh->getTauxServiceCompl(), ]; $vhData = $vhHydrator->extract($vh); unset($vhData['id']); $tvh = new FormuleTestVolumeHoraire(); $vhHydrator->hydrate($vhData, $tvh); $fti->addVolumeHoraire($tvh); } $fti = new FormuleTestIntervenant(); $fti->setLibelle((string)$intervenant); $fti->setFormule($formule); $fti->setAnnee($intervenant->getAnnee()); $fti->setTypeIntervenant($intervenant->getStatut()->getTypeIntervenant()); $fti->setTypeVolumeHoraire($typeVolumeHoraire); $fti->setEtatVolumeHoraire($etatVolumeHoraire); $fti->setHeuresServiceStatutaire((float)$idata['HEURES_SERVICE_STATUTAIRE']); $fti->setHeuresServiceModifie((float)$idata['HEURES_SERVICE_MODIFIE']); $fti->setDepassementServiceDuSansHC($idata['DEPASSEMENT_SERVICE_DU_SANS_HC'] == '1'); $fti->setParam1($idata['PARAM_1']); $fti->setParam2($idata['PARAM_2']); $fti->setParam3($idata['PARAM_3']); $fti->setParam4($idata['PARAM_4']); $fti->setParam5($idata['PARAM_5']); $fti->setStructureCode($idata['STRUCTURE_CODE']); $fti->setFormule($this->getServiceFormule()->getCurrent($intervenant->getId())); /* Traitement des taux */ return $fti; /* Réduction des types d'intervention de la fiche à CP/TD/TP/AUTRE */ $typesIntervention = [ Loading Loading @@ -170,7 +174,7 @@ class TestService extends AbstractEntityService $ftvh->setHeures((float)$vh['HEURES']); $fti->addVolumeHoraireTest($ftvh); } $this->save($fti); //$this->save($fti); return $fti; } Loading Loading
code/test6.php +14 −9 Changes for code/test6.php: 14 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -5,19 +5,24 @@ * @var $container \Psr\Container\ContainerInterface */ use Formule\Model\FormuleDetailsExtractor; $em = $container->get(\Doctrine\ORM\EntityManager::class); $fts = $container->get(\Formule\Service\TestService::class); $fs = $container->get(\Formule\Service\FormuleService::class); //2023/2024 - DALMASSO Marion $fi = $fs->getFormuleServiceIntervenant(783665, 1, 1); $intervenantId = 783665; $typeVolumeHoraireId = 1; $etatVolumeHoraireId = 1; $intervenant = $em->find(\Intervenant\Entity\Db\Intervenant::class, $intervenantId); $typeVolumeHoraire = $em->find(\Service\Entity\Db\TypeVolumeHoraire::class, $typeVolumeHoraireId); $etatVolumeHoraire = $em->find(\Service\Entity\Db\EtatVolumeHoraire::class, $etatVolumeHoraireId); if (null == $fi->getArrondisseurTrace()) { $fs->calculer($fi); } $trace = $fi->getArrondisseurTrace(); $vu = $trace->getValeursUtilisees(); $ft = $fts->creerDepuisIntervenant($intervenant, $typeVolumeHoraire, $etatVolumeHoraire); var_dump($vu); No newline at end of file var_dump($ft); No newline at end of file
module/Application/src/Hydrator/GenericHydrator.php +2 −2 Changes for module/Application/src/Hydrator/GenericHydrator.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -29,11 +29,11 @@ class GenericHydrator implements HydratorInterface public function __construct(EntityManager $entityManager, string|object|array $spec = []) public function __construct(EntityManager $entityManager, string|object|array $spec = [], array $ignore = []) { $this->setEntityManager($entityManager); if (!empty($spec)) { $this->spec($spec); $this->spec($spec, $ignore); } } Loading
module/Formule/src/Service/TestService.php +31 −27 Changes for module/Formule/src/Service/TestService.php: 31 added lines, 27 removed lines. Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Formule\Service; use Application\Hydrator\GenericHydrator; use Application\Service\AbstractEntityService; use Application\Service\Traits\ParametresServiceAwareTrait; use Formule\Entity\FormuleVolumeHoraire; use RuntimeException; use Formule\Entity\Db\Formule; use Formule\Entity\Db\FormuleTestIntervenant; Loading Loading @@ -74,38 +75,41 @@ class TestService extends AbstractEntityService public function creerDepuisIntervenant(Intervenant $intervenant, TypeVolumeHoraire $typeVolumeHoraire, EtatVolumeHoraire $etatVolumeHoraire): FormuleTestIntervenant { $conn = $this->getEntityManager()->getConnection(); $fsi = $this->getServiceFormule()->getFormuleServiceIntervenant($intervenant, $typeVolumeHoraire, $etatVolumeHoraire); $formule = $this->getServiceFormule()->getCurrent(); $intervenantQuery = trim($conn->executeQuery('SELECT ' . $formule->getCode() . '.INTERVENANT_QUERY Q FROM DUAL')->fetchOne()); $volumeHoraireQuery = trim($conn->executeQuery('SELECT ' . $formule->getCode() . '.VOLUME_HORAIRE_QUERY Q FROM DUAL')->fetchOne()); $fti = new FormuleTestIntervenant(); $sql = "BEGIN ose_formule.intervenant.id := " . $intervenant->getId() . "; END;"; $conn->executeStatement($sql); $hydrator = new GenericHydrator($this->getEntityManager(), $fsi); $hydrator->setExtractType($hydrator::EXTRACT_TYPE_ORIGINAL); $params = ['intervenant' => $intervenant->getId()]; $data = $hydrator->extract($fsi); $idata = $conn->fetchAllAssociative('SELECT * FROM (' . $intervenantQuery . ') q WHERE intervenant_id = :intervenant', $params)[0]; $params['typeVolumeHoraire'] = $typeVolumeHoraire->getId(); $params['etatVolumeHoraire'] = $etatVolumeHoraire->getId(); $vhdata = $conn->fetchAllAssociative('SELECT * FROM (' . $volumeHoraireQuery . ') q WHERE intervenant_id = :intervenant AND type_volume_horaire_id = :typeVolumeHoraire AND etat_volume_horaire_id >= :etatVolumeHoraire', $params); unset($data['id']); $hydrator->hydrate($data, $fti); $taux = []; $vhIgnore = ['id','formuleIntervenant', 'tauxServiceDu', 'tauxServiceCompl']; $vhHydrator = new GenericHydrator($this->getEntityManager(), FormuleVolumeHoraire::class, $vhIgnore); foreach( $fsi->getVolumesHoraires() as $vh){ $taux[$vh->getTypeInterventionCode()] = [ 'serviceDu' => $vh->getTauxServiceDu(), 'serviceCompl' => $vh->getTauxServiceCompl(), ]; $vhData = $vhHydrator->extract($vh); unset($vhData['id']); $tvh = new FormuleTestVolumeHoraire(); $vhHydrator->hydrate($vhData, $tvh); $fti->addVolumeHoraire($tvh); } $fti = new FormuleTestIntervenant(); $fti->setLibelle((string)$intervenant); $fti->setFormule($formule); $fti->setAnnee($intervenant->getAnnee()); $fti->setTypeIntervenant($intervenant->getStatut()->getTypeIntervenant()); $fti->setTypeVolumeHoraire($typeVolumeHoraire); $fti->setEtatVolumeHoraire($etatVolumeHoraire); $fti->setHeuresServiceStatutaire((float)$idata['HEURES_SERVICE_STATUTAIRE']); $fti->setHeuresServiceModifie((float)$idata['HEURES_SERVICE_MODIFIE']); $fti->setDepassementServiceDuSansHC($idata['DEPASSEMENT_SERVICE_DU_SANS_HC'] == '1'); $fti->setParam1($idata['PARAM_1']); $fti->setParam2($idata['PARAM_2']); $fti->setParam3($idata['PARAM_3']); $fti->setParam4($idata['PARAM_4']); $fti->setParam5($idata['PARAM_5']); $fti->setStructureCode($idata['STRUCTURE_CODE']); $fti->setFormule($this->getServiceFormule()->getCurrent($intervenant->getId())); /* Traitement des taux */ return $fti; /* Réduction des types d'intervention de la fiche à CP/TD/TP/AUTRE */ $typesIntervention = [ Loading Loading @@ -170,7 +174,7 @@ class TestService extends AbstractEntityService $ftvh->setHeures((float)$vh['HEURES']); $fti->addVolumeHoraireTest($ftvh); } $this->save($fti); //$this->save($fti); return $fti; } Loading