la méthode find de l'objet retourne l'objet lui même

This commit is contained in:
Gregory Letellier
2023-11-07 10:36:01 +01:00
parent 97c8a8a92c
commit fd54281ce3
2 changed files with 8 additions and 6 deletions

View File

@@ -66,16 +66,15 @@ class Model
return $this;
}
public function find(mixed $key): bool
{
$res = false;
public function find(mixed $key): mixed
{
$qb = $this->newQueryBuilder();
$find = $qb->find($key);
if ($find !== null) {
$this->fillData($find->getValues());
$res = true;
return $this;
}
return $res;
return null;
}
public function save(): bool