meilleure gestion des noms de tables sur les modèles hérités

This commit is contained in:
Gregory Letellier
2023-11-14 15:55:08 +01:00
parent 03d26d9167
commit c8d6e911a6

View File

@@ -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