Loading admin/actions/update-ddl.php +14 Changes for admin/actions/update-ddl.php: 14 added lines, 0 removed lines. Original line number Diff line number Diff line <?php $dirname = $oa->getOseDir() . 'data/ddl'; $colPosFile = $oa->getOseDir() . 'data/ddl_columns_pos.php'; $filters = [ 'table' => ['excludes' => 'UNICAEN_%'], Loading @@ -20,5 +21,18 @@ $filters = [ $c->begin('Génération du fichier de DDL à partir de la base de données'); $ddl = $oa->getBdd()->getDdl($filters); /* Traitement des positionnement de colonnes */ if (file_exists($colPosFile)) { $positions = require_once $colPosFile; } else { $positions = []; } $positions = $ddl->applyColumnPositions($positions); $ddl->writeArray($colPosFile, $positions); $c->end('Positionnement de colonnes à jour'); $ddl->saveToDir($dirname); $c->end('Définition Fichier de la base de données mise à jour'); No newline at end of file admin/src/BddAdmin/Ddl/Ddl.php +44 −1 Changes for admin/src/BddAdmin/Ddl/Ddl.php: 44 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -232,7 +232,50 @@ class Ddl implements \Iterator, \ArrayAccess protected function writeArray(string $filename, array $data) /** * @param array $positions * * @return array */ public function applyColumnPositions(array $positions): array { $tables = $this->get(Ddl::TABLE); foreach ($tables as $tableName => $table) { $cols = []; foreach ($positions[$tableName] as $idc => $col) { if (!array_key_exists($col, $table['columns'])) { unset($positions[$tableName][$idc]); } } foreach ($table['columns'] as $column) { $colname = $column['name']; if (!isset($positions[$tableName]) || !in_array($colname, $positions[$tableName])) { $cols[$colname] = $column['position']; } } asort($cols); $cols = array_keys($cols); if (!isset($positions[$tableName])) { $positions[$tableName] = []; } $cols = array_merge($positions[$tableName], $cols); foreach ($cols as $pos => $col) { if (isset($this->data[Ddl::TABLE][$tableName]['columns'][$col])) { $this->data[Ddl::TABLE][$tableName]['columns'][$col]['position'] = $pos + 1; } } $positions[$tableName] = $cols; } return $positions; } public function writeArray(string $filename, array $data) { $ddlString = "<?php\n\n//@" . "formatter:off\n\nreturn " . $this->arrayExport($data) . ";\n\n//@" . "formatter:on\n"; Loading data/ddl/table/ADRESSE_NUMERO_COMPL.php +2 −2 Changes for data/ddl/table/ADRESSE_NUMERO_COMPL.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 1, 'position' => 2, 'commentaire' => NULL, ], 'ID' => [ Loading @@ -30,7 +30,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 2, 'position' => 1, 'commentaire' => NULL, ], 'LIBELLE' => [ Loading data/ddl/table/AFFECTATION.php +11 −11 Changes for data/ddl/table/AFFECTATION.php: 11 added lines, 11 removed lines. Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 7, 'position' => 8, 'commentaire' => NULL, ], 'HISTO_CREATION' => [ Loading @@ -30,7 +30,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => 'SYSDATE', 'position' => 6, 'position' => 7, 'commentaire' => NULL, ], 'HISTO_DESTRUCTEUR_ID' => [ Loading @@ -42,7 +42,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 11, 'position' => 12, 'commentaire' => NULL, ], 'HISTO_DESTRUCTION' => [ Loading @@ -54,7 +54,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 10, 'position' => 11, 'commentaire' => NULL, ], 'HISTO_MODIFICATEUR_ID' => [ Loading @@ -66,7 +66,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 9, 'position' => 10, 'commentaire' => NULL, ], 'HISTO_MODIFICATION' => [ Loading @@ -78,7 +78,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => 'SYSDATE', 'position' => 8, 'position' => 9, 'commentaire' => NULL, ], 'ID' => [ Loading @@ -102,7 +102,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 2, 'position' => 3, 'commentaire' => NULL, ], 'SOURCE_CODE' => [ Loading @@ -114,7 +114,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 5, 'position' => 6, 'commentaire' => NULL, ], 'SOURCE_ID' => [ Loading @@ -126,7 +126,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 4, 'position' => 5, 'commentaire' => NULL, ], 'STRUCTURE_ID' => [ Loading @@ -138,7 +138,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 3, 'position' => 4, 'commentaire' => NULL, ], 'UTILISATEUR_ID' => [ Loading @@ -150,7 +150,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 12, 'position' => 2, 'commentaire' => NULL, ], ], Loading data/ddl/table/AFFECTATION_RECHERCHE.php +9 −9 Changes for data/ddl/table/AFFECTATION_RECHERCHE.php: 9 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 7, 'position' => 8, 'commentaire' => NULL, ], 'HISTO_CREATION' => [ Loading @@ -30,7 +30,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => 'SYSDATE', 'position' => 6, 'position' => 7, 'commentaire' => NULL, ], 'HISTO_DESTRUCTEUR_ID' => [ Loading @@ -42,7 +42,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 11, 'position' => 12, 'commentaire' => NULL, ], 'HISTO_DESTRUCTION' => [ Loading @@ -54,7 +54,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 10, 'position' => 11, 'commentaire' => NULL, ], 'HISTO_MODIFICATEUR_ID' => [ Loading @@ -66,7 +66,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 9, 'position' => 10, 'commentaire' => NULL, ], 'HISTO_MODIFICATION' => [ Loading @@ -78,7 +78,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => 'SYSDATE', 'position' => 8, 'position' => 9, 'commentaire' => NULL, ], 'ID' => [ Loading Loading @@ -114,7 +114,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 12, 'position' => 4, 'commentaire' => NULL, ], 'SOURCE_CODE' => [ Loading @@ -126,7 +126,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 5, 'position' => 6, 'commentaire' => NULL, ], 'SOURCE_ID' => [ Loading @@ -138,7 +138,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 4, 'position' => 5, 'commentaire' => NULL, ], 'STRUCTURE_ID' => [ Loading Loading
admin/actions/update-ddl.php +14 Changes for admin/actions/update-ddl.php: 14 added lines, 0 removed lines. Original line number Diff line number Diff line <?php $dirname = $oa->getOseDir() . 'data/ddl'; $colPosFile = $oa->getOseDir() . 'data/ddl_columns_pos.php'; $filters = [ 'table' => ['excludes' => 'UNICAEN_%'], Loading @@ -20,5 +21,18 @@ $filters = [ $c->begin('Génération du fichier de DDL à partir de la base de données'); $ddl = $oa->getBdd()->getDdl($filters); /* Traitement des positionnement de colonnes */ if (file_exists($colPosFile)) { $positions = require_once $colPosFile; } else { $positions = []; } $positions = $ddl->applyColumnPositions($positions); $ddl->writeArray($colPosFile, $positions); $c->end('Positionnement de colonnes à jour'); $ddl->saveToDir($dirname); $c->end('Définition Fichier de la base de données mise à jour'); No newline at end of file
admin/src/BddAdmin/Ddl/Ddl.php +44 −1 Changes for admin/src/BddAdmin/Ddl/Ddl.php: 44 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -232,7 +232,50 @@ class Ddl implements \Iterator, \ArrayAccess protected function writeArray(string $filename, array $data) /** * @param array $positions * * @return array */ public function applyColumnPositions(array $positions): array { $tables = $this->get(Ddl::TABLE); foreach ($tables as $tableName => $table) { $cols = []; foreach ($positions[$tableName] as $idc => $col) { if (!array_key_exists($col, $table['columns'])) { unset($positions[$tableName][$idc]); } } foreach ($table['columns'] as $column) { $colname = $column['name']; if (!isset($positions[$tableName]) || !in_array($colname, $positions[$tableName])) { $cols[$colname] = $column['position']; } } asort($cols); $cols = array_keys($cols); if (!isset($positions[$tableName])) { $positions[$tableName] = []; } $cols = array_merge($positions[$tableName], $cols); foreach ($cols as $pos => $col) { if (isset($this->data[Ddl::TABLE][$tableName]['columns'][$col])) { $this->data[Ddl::TABLE][$tableName]['columns'][$col]['position'] = $pos + 1; } } $positions[$tableName] = $cols; } return $positions; } public function writeArray(string $filename, array $data) { $ddlString = "<?php\n\n//@" . "formatter:off\n\nreturn " . $this->arrayExport($data) . ";\n\n//@" . "formatter:on\n"; Loading
data/ddl/table/ADRESSE_NUMERO_COMPL.php +2 −2 Changes for data/ddl/table/ADRESSE_NUMERO_COMPL.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 1, 'position' => 2, 'commentaire' => NULL, ], 'ID' => [ Loading @@ -30,7 +30,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 2, 'position' => 1, 'commentaire' => NULL, ], 'LIBELLE' => [ Loading
data/ddl/table/AFFECTATION.php +11 −11 Changes for data/ddl/table/AFFECTATION.php: 11 added lines, 11 removed lines. Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 7, 'position' => 8, 'commentaire' => NULL, ], 'HISTO_CREATION' => [ Loading @@ -30,7 +30,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => 'SYSDATE', 'position' => 6, 'position' => 7, 'commentaire' => NULL, ], 'HISTO_DESTRUCTEUR_ID' => [ Loading @@ -42,7 +42,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 11, 'position' => 12, 'commentaire' => NULL, ], 'HISTO_DESTRUCTION' => [ Loading @@ -54,7 +54,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 10, 'position' => 11, 'commentaire' => NULL, ], 'HISTO_MODIFICATEUR_ID' => [ Loading @@ -66,7 +66,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 9, 'position' => 10, 'commentaire' => NULL, ], 'HISTO_MODIFICATION' => [ Loading @@ -78,7 +78,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => 'SYSDATE', 'position' => 8, 'position' => 9, 'commentaire' => NULL, ], 'ID' => [ Loading @@ -102,7 +102,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 2, 'position' => 3, 'commentaire' => NULL, ], 'SOURCE_CODE' => [ Loading @@ -114,7 +114,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 5, 'position' => 6, 'commentaire' => NULL, ], 'SOURCE_ID' => [ Loading @@ -126,7 +126,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 4, 'position' => 5, 'commentaire' => NULL, ], 'STRUCTURE_ID' => [ Loading @@ -138,7 +138,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 3, 'position' => 4, 'commentaire' => NULL, ], 'UTILISATEUR_ID' => [ Loading @@ -150,7 +150,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 12, 'position' => 2, 'commentaire' => NULL, ], ], Loading
data/ddl/table/AFFECTATION_RECHERCHE.php +9 −9 Changes for data/ddl/table/AFFECTATION_RECHERCHE.php: 9 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 7, 'position' => 8, 'commentaire' => NULL, ], 'HISTO_CREATION' => [ Loading @@ -30,7 +30,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => 'SYSDATE', 'position' => 6, 'position' => 7, 'commentaire' => NULL, ], 'HISTO_DESTRUCTEUR_ID' => [ Loading @@ -42,7 +42,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 11, 'position' => 12, 'commentaire' => NULL, ], 'HISTO_DESTRUCTION' => [ Loading @@ -54,7 +54,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 10, 'position' => 11, 'commentaire' => NULL, ], 'HISTO_MODIFICATEUR_ID' => [ Loading @@ -66,7 +66,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 9, 'position' => 10, 'commentaire' => NULL, ], 'HISTO_MODIFICATION' => [ Loading @@ -78,7 +78,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => 'SYSDATE', 'position' => 8, 'position' => 9, 'commentaire' => NULL, ], 'ID' => [ Loading Loading @@ -114,7 +114,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 12, 'position' => 4, 'commentaire' => NULL, ], 'SOURCE_CODE' => [ Loading @@ -126,7 +126,7 @@ return [ 'precision' => NULL, 'nullable' => TRUE, 'default' => NULL, 'position' => 5, 'position' => 6, 'commentaire' => NULL, ], 'SOURCE_ID' => [ Loading @@ -138,7 +138,7 @@ return [ 'precision' => NULL, 'nullable' => FALSE, 'default' => NULL, 'position' => 4, 'position' => 5, 'commentaire' => NULL, ], 'STRUCTURE_ID' => [ Loading