diff --git a/ActiveQuery.php b/ActiveQuery.php index 23df5d1..1974180 100644 --- a/ActiveQuery.php +++ b/ActiveQuery.php @@ -108,6 +108,17 @@ class ActiveQuery extends Component implements ISqlBuilder 'param' => $lists, ]; } + + + /** + * @param bool $asArray + * @return static + */ + public function asArray(bool $asArray = true): static + { + $this->asArray = $asArray; + return $this; + } /** diff --git a/Traits/HasBase.php b/Traits/HasBase.php index f2bac84..5166e9c 100644 --- a/Traits/HasBase.php +++ b/Traits/HasBase.php @@ -34,18 +34,17 @@ abstract class HasBase implements \Database\Traits\Relation * @var ModelInterface */ protected mixed $model; - - + + protected mixed $value = 0; - - + + /** * HasBase constructor. * @param string $name */ public function __construct(public string $name) { - ; } /** @@ -55,16 +54,14 @@ 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; } - + /** * @param $name * @return mixed