This commit is contained in:
2023-04-01 21:04:28 +08:00
parent eac2800561
commit 0450226d36
2 changed files with 19 additions and 11 deletions
+11
View File
@@ -110,6 +110,17 @@ class ActiveQuery extends Component implements ISqlBuilder
}
/**
* @param bool $asArray
* @return static
*/
public function asArray(bool $asArray = true): static
{
$this->asArray = $asArray;
return $this;
}
/**
* @param array $values
* @return $this
+3 -6
View File
@@ -45,7 +45,6 @@ abstract class HasBase implements \Database\Traits\Relation
*/
public function __construct(public string $name)
{
;
}
/**
@@ -55,13 +54,11 @@ abstract class HasBase implements \Database\Traits\Relation
*/
public function __call($name, $arguments)
{
if (!method_exists($this, $name)) {
$relation = Kiri::getDi()->get(Relation::class);
$relation->getQuery($this->name)->$name(...$arguments);
if ($name !== 'get') {
return di(Relation::class)->getQuery($this->name)->$name(...$arguments);
} else {
call_user_func([$this, $name], ...$arguments);
return $this->get();
}
return $this;
}