From c8d6e911a685a0a13186833db02aae6882b426a1 Mon Sep 17 00:00:00 2001 From: Gregory Letellier Date: Tue, 14 Nov 2023 15:55:08 +0100 Subject: [PATCH] =?UTF-8?q?meilleure=20gestion=20des=20noms=20de=20tables?= =?UTF-8?q?=20sur=20les=20mod=C3=A8les=20h=C3=A9rit=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Model.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Model.php b/src/Model.php index 4a19a83..475fffe 100644 --- a/src/Model.php +++ b/src/Model.php @@ -8,7 +8,7 @@ class Model implements JsonSerializable { protected mixed $values; protected array $updated; - protected string $table; + protected string $table = ""; protected string $connection = ""; protected string $pk; private bool $new; @@ -19,7 +19,14 @@ class Model implements JsonSerializable $this->values = array(); $this->updated = array(); $this->pk = "id"; - $this->table = $this->getDefaultTableName(); + $this->initTable(); + } + + private function initTable(): void + { + if ($this->table == "") { + $this->table = $this->getDefaultTableName(); + } } public function getTable(): string