Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ Changelog 6.1.2 ----- - Possibilité de voir le SQL généré et utilisé pour réaliser une synchro. - Ajout de la colonne IMPORT_OBSERV_RESULT.SOURCE_ID permettant de filtrer selon la source de données. - Import : possibilité de spécifier des colonnes dont la valeur est calculée (clé 'computed_columns'). - Possibilité de spécifier la liste des attributs/colonnes de la Source dans la config (clé 'columns'). Loading src/UnicaenDbImport/Controller/SynchroController.php +2 −0 Original line number Diff line number Diff line Loading @@ -109,12 +109,14 @@ class SynchroController extends AbstractActionController $diff = $this->synchroService->fetchSynchroDiff($synchro); $count = $this->synchroService->fetchSynchroDiffCount($synchro); $sqls = $this->synchroService->fetchSynchroSql($synchro); return [ 'synchro' => $synchro, 'diff' => $diff, 'limit' => 30, 'count' => $count, 'sqls' => $sqls, ]; } Loading src/UnicaenDbImport/Service/Database/DatabaseService.php +16 −2 Original line number Diff line number Diff line Loading @@ -482,8 +482,8 @@ class DatabaseService extends AbstractDatabaseService $connection = $this->destination->getConnection(); $results = []; foreach (Operation::OPERATIONS as $operation) { $sql = $this->codeGenerator->generateSQLForDestinationUpdate($operation, $this->source, $this->destination); $sqls = $this->generateUpdateDestinationSql(); foreach ($sqls as $operation => $sql) { try { $connection->beginTransaction(); $result = $this->queryExecutor->exec($sql, $connection); Loading @@ -499,6 +499,20 @@ class DatabaseService extends AbstractDatabaseService return $results; } /** * @return string[] ['operation' => 'sql'] */ public function generateUpdateDestinationSql(): array { $sqls = []; foreach (Operation::OPERATIONS as $operation) { $sqls[$operation] = $this->codeGenerator->generateSQLForDestinationUpdate($operation, $this->source, $this->destination); } return $sqls; } /** * Requête la Source pour obtenir les données sources. * Loading src/UnicaenDbImport/Service/Facade/SynchroFacadeService.php +10 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,16 @@ class SynchroFacadeService extends AbstractFacadeService return $result; } /** * @throws \UnicaenDbImport\Service\Exception\DatabaseServiceException */ public function generateSynchroSql(): array { $this->recreateDiffView(); return $this->databaseService->generateUpdateDestinationSql(); } /** * @throws \UnicaenDbImport\Service\Exception\DatabaseServiceException * @throws \UnicaenDbImport\Service\Exception\ApiServiceException Loading src/UnicaenDbImport/Service/SynchroService.php +15 −0 Original line number Diff line number Diff line Loading @@ -216,4 +216,19 @@ class SynchroService throw new RuntimeException("Erreur rencontrée : " . $e->getMessage(), null, $e); } } /** * @param \UnicaenDbImport\Domain\SynchroInterface $synchro * @return string[] ['operation' => 'sql'] */ public function fetchSynchroSql(SynchroInterface $synchro): array { $this->synchroFacadeService->setSynchro($synchro); try { return $this->synchroFacadeService->generateSynchroSql(); } catch (Exception $e) { throw new RuntimeException("Erreur rencontrée : " . $e->getMessage(), null, $e); } } } No newline at end of file Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ Changelog 6.1.2 ----- - Possibilité de voir le SQL généré et utilisé pour réaliser une synchro. - Ajout de la colonne IMPORT_OBSERV_RESULT.SOURCE_ID permettant de filtrer selon la source de données. - Import : possibilité de spécifier des colonnes dont la valeur est calculée (clé 'computed_columns'). - Possibilité de spécifier la liste des attributs/colonnes de la Source dans la config (clé 'columns'). Loading
src/UnicaenDbImport/Controller/SynchroController.php +2 −0 Original line number Diff line number Diff line Loading @@ -109,12 +109,14 @@ class SynchroController extends AbstractActionController $diff = $this->synchroService->fetchSynchroDiff($synchro); $count = $this->synchroService->fetchSynchroDiffCount($synchro); $sqls = $this->synchroService->fetchSynchroSql($synchro); return [ 'synchro' => $synchro, 'diff' => $diff, 'limit' => 30, 'count' => $count, 'sqls' => $sqls, ]; } Loading
src/UnicaenDbImport/Service/Database/DatabaseService.php +16 −2 Original line number Diff line number Diff line Loading @@ -482,8 +482,8 @@ class DatabaseService extends AbstractDatabaseService $connection = $this->destination->getConnection(); $results = []; foreach (Operation::OPERATIONS as $operation) { $sql = $this->codeGenerator->generateSQLForDestinationUpdate($operation, $this->source, $this->destination); $sqls = $this->generateUpdateDestinationSql(); foreach ($sqls as $operation => $sql) { try { $connection->beginTransaction(); $result = $this->queryExecutor->exec($sql, $connection); Loading @@ -499,6 +499,20 @@ class DatabaseService extends AbstractDatabaseService return $results; } /** * @return string[] ['operation' => 'sql'] */ public function generateUpdateDestinationSql(): array { $sqls = []; foreach (Operation::OPERATIONS as $operation) { $sqls[$operation] = $this->codeGenerator->generateSQLForDestinationUpdate($operation, $this->source, $this->destination); } return $sqls; } /** * Requête la Source pour obtenir les données sources. * Loading
src/UnicaenDbImport/Service/Facade/SynchroFacadeService.php +10 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,16 @@ class SynchroFacadeService extends AbstractFacadeService return $result; } /** * @throws \UnicaenDbImport\Service\Exception\DatabaseServiceException */ public function generateSynchroSql(): array { $this->recreateDiffView(); return $this->databaseService->generateUpdateDestinationSql(); } /** * @throws \UnicaenDbImport\Service\Exception\DatabaseServiceException * @throws \UnicaenDbImport\Service\Exception\ApiServiceException Loading
src/UnicaenDbImport/Service/SynchroService.php +15 −0 Original line number Diff line number Diff line Loading @@ -216,4 +216,19 @@ class SynchroService throw new RuntimeException("Erreur rencontrée : " . $e->getMessage(), null, $e); } } /** * @param \UnicaenDbImport\Domain\SynchroInterface $synchro * @return string[] ['operation' => 'sql'] */ public function fetchSynchroSql(SynchroInterface $synchro): array { $this->synchroFacadeService->setSynchro($synchro); try { return $this->synchroFacadeService->generateSynchroSql(); } catch (Exception $e) { throw new RuntimeException("Erreur rencontrée : " . $e->getMessage(), null, $e); } } } No newline at end of file