Loading CHANGELOG.md +5 −0 Original line number Diff line number Diff line 1.0.2 (21/11/2024) ------------------ - [Optimisation] Table récupère maintenant la DDL depuis le fichier de ddl, et à défaut la recalcule depuis le BDD 1.0.1 (19/11/2024) ------------------ Loading src/Table.php +27 −3 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace Unicaen\BddAdmin; use Unicaen\BddAdmin\Ddl\Ddl; class Table { Loading Loading @@ -39,9 +41,14 @@ class Table public function getDdl(): array { if (empty($this->ddl)) { $ddlFromFile = $this->getDdlFromFile(); if (!empty($ddlFromFile)) { $this->ddl = $ddlFromFile; } else { $sTable = $this->getBdd()->table(); $this->ddl = $sTable->get($this->name)[$this->name]; } } if (!$this->ddl) { throw new \Exception('La DDL de la table ' . $this->name . ' n\'a pas pu être calculée'); } Loading @@ -51,6 +58,23 @@ class Table public function getDdlFromFile(): array { [$schema,$name] = Util::explodedFullObjectName($this->getName()); $ddlDir = $this->getBdd()->getOption(Bdd::OPTION_DDL . '/' . Ddl::OPTION_DIR); $filename = $ddlDir . '/' . Ddl::TABLE . '/' . Util::fullObjectName($schema, $name) . '.php'; if (file_exists($filename)) { $ddl = require $filename; if (is_array($ddl) && $ddl['name'] == $name) { return $ddl; } } return []; } public function setDdl(array $ddl): self { $this->ddl = $ddl; Loading Loading
CHANGELOG.md +5 −0 Original line number Diff line number Diff line 1.0.2 (21/11/2024) ------------------ - [Optimisation] Table récupère maintenant la DDL depuis le fichier de ddl, et à défaut la recalcule depuis le BDD 1.0.1 (19/11/2024) ------------------ Loading
src/Table.php +27 −3 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace Unicaen\BddAdmin; use Unicaen\BddAdmin\Ddl\Ddl; class Table { Loading Loading @@ -39,9 +41,14 @@ class Table public function getDdl(): array { if (empty($this->ddl)) { $ddlFromFile = $this->getDdlFromFile(); if (!empty($ddlFromFile)) { $this->ddl = $ddlFromFile; } else { $sTable = $this->getBdd()->table(); $this->ddl = $sTable->get($this->name)[$this->name]; } } if (!$this->ddl) { throw new \Exception('La DDL de la table ' . $this->name . ' n\'a pas pu être calculée'); } Loading @@ -51,6 +58,23 @@ class Table public function getDdlFromFile(): array { [$schema,$name] = Util::explodedFullObjectName($this->getName()); $ddlDir = $this->getBdd()->getOption(Bdd::OPTION_DDL . '/' . Ddl::OPTION_DIR); $filename = $ddlDir . '/' . Ddl::TABLE . '/' . Util::fullObjectName($schema, $name) . '.php'; if (file_exists($filename)) { $ddl = require $filename; if (is_array($ddl) && $ddl['name'] == $name) { return $ddl; } } return []; } public function setDdl(array $ddl): self { $this->ddl = $ddl; Loading