1 Commits
1.0.2 ... 1.0.3

Author SHA1 Message Date
Gregory Letellier
c8d6e911a6 meilleure gestion des noms de tables sur les modèles hérités 2023-11-14 15:55:08 +01:00

View File

@@ -8,7 +8,7 @@ class Model implements JsonSerializable
{ {
protected mixed $values; protected mixed $values;
protected array $updated; protected array $updated;
protected string $table; protected string $table = "";
protected string $connection = ""; protected string $connection = "";
protected string $pk; protected string $pk;
private bool $new; private bool $new;
@@ -19,8 +19,15 @@ class Model implements JsonSerializable
$this->values = array(); $this->values = array();
$this->updated = array(); $this->updated = array();
$this->pk = "id"; $this->pk = "id";
$this->initTable();
}
private function initTable(): void
{
if ($this->table == "") {
$this->table = $this->getDefaultTableName(); $this->table = $this->getDefaultTableName();
} }
}
public function getTable(): string public function getTable(): string
{ {