Loading src/UnicaenDbImport/CodeGenerator/CodeGenerator.php +4 −0 Original line number Diff line number Diff line Loading @@ -269,7 +269,11 @@ abstract class CodeGenerator implements CodeGeneratorInterface ?string $idColumnStrategy = null, ?string $idColumnSequence = null): string { try { return $this->tableHelper->generateSQLForInsertOneRowIntoTable($tableName, $row, $sourceCode, $idColumnStrategy, $idColumnSequence); } catch (Helper\HelperException $e) { throw new RuntimeException("Erreur rencontrée lors de la génération SQL", null, $e); } } /** Loading src/UnicaenDbImport/CodeGenerator/Helper/TableHelper.php +8 −0 Original line number Diff line number Diff line Loading @@ -313,6 +313,7 @@ EOT; * @param string|null $idColumnStrategy * @param string|null $idColumnSequence * @return string * @throws \UnicaenDbImport\CodeGenerator\Helper\HelperException */ public function generateSQLForInsertOneRowIntoTable( string $destinationTable, Loading Loading @@ -362,8 +363,15 @@ EOT; $valuesToAdd[] = 's.id'; } else { // si la Source n'est pas fournie (par son 'code'), elle est présente dans les données (colonne 'SOURCE_ID') if (array_key_exists('SOURCE_ID', $row)) { $sourceCode = $row['SOURCE_ID']; $row['SOURCE_ID'] = 's.id'; } elseif (array_key_exists('source_id', $row)) { $sourceCode = $row['source_id']; $row['source_id'] = 's.id'; } else { throw new HelperException("La colonne 'source_id' (ou 'SOURCE_ID') devrait être présente dans les données"); } } // génération des noms de colonnes de la table destination pour l'INSERT. Loading Loading
src/UnicaenDbImport/CodeGenerator/CodeGenerator.php +4 −0 Original line number Diff line number Diff line Loading @@ -269,7 +269,11 @@ abstract class CodeGenerator implements CodeGeneratorInterface ?string $idColumnStrategy = null, ?string $idColumnSequence = null): string { try { return $this->tableHelper->generateSQLForInsertOneRowIntoTable($tableName, $row, $sourceCode, $idColumnStrategy, $idColumnSequence); } catch (Helper\HelperException $e) { throw new RuntimeException("Erreur rencontrée lors de la génération SQL", null, $e); } } /** Loading
src/UnicaenDbImport/CodeGenerator/Helper/TableHelper.php +8 −0 Original line number Diff line number Diff line Loading @@ -313,6 +313,7 @@ EOT; * @param string|null $idColumnStrategy * @param string|null $idColumnSequence * @return string * @throws \UnicaenDbImport\CodeGenerator\Helper\HelperException */ public function generateSQLForInsertOneRowIntoTable( string $destinationTable, Loading Loading @@ -362,8 +363,15 @@ EOT; $valuesToAdd[] = 's.id'; } else { // si la Source n'est pas fournie (par son 'code'), elle est présente dans les données (colonne 'SOURCE_ID') if (array_key_exists('SOURCE_ID', $row)) { $sourceCode = $row['SOURCE_ID']; $row['SOURCE_ID'] = 's.id'; } elseif (array_key_exists('source_id', $row)) { $sourceCode = $row['source_id']; $row['source_id'] = 's.id'; } else { throw new HelperException("La colonne 'source_id' (ou 'SOURCE_ID') devrait être présente dans les données"); } } // génération des noms de colonnes de la table destination pour l'INSERT. Loading