Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
c6806a1c62 | |||
5f3f6b72e5 | |||
6fd19a11be | |||
a1466143b5 |
@ -29,7 +29,7 @@ class Model {
|
||||
$model = $model->where([[$f, $v]]);
|
||||
}
|
||||
$model = $model->one();
|
||||
if ($model !== false) {
|
||||
if ($model !== null) {
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
@ -342,28 +342,28 @@ class Model {
|
||||
return $orm->offset($this->offset);
|
||||
}
|
||||
|
||||
public function one($id = null): ModelInterface {
|
||||
public function one($id = null): ?ModelInterface {
|
||||
$result = $this->build()->findOne($id);
|
||||
if (!$result) {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
$result->setFactory($this);
|
||||
return $result;
|
||||
}
|
||||
public function many(): array {
|
||||
public function many(): ?array {
|
||||
$results = $this->build()->findMany();
|
||||
if (!$results) {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
foreach ($results as &$r) {
|
||||
$r->setFactory($this);
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
public function array(): array {
|
||||
public function array(): ?array {
|
||||
$results = $this->build()->findArray();
|
||||
if (!$results) {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
Reference in New Issue
Block a user