变更
This commit is contained in:
@@ -108,6 +108,17 @@ class ActiveQuery extends Component implements ISqlBuilder
|
|||||||
'param' => $lists,
|
'param' => $lists,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $asArray
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function asArray(bool $asArray = true): static
|
||||||
|
{
|
||||||
|
$this->asArray = $asArray;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+8
-11
@@ -34,18 +34,17 @@ abstract class HasBase implements \Database\Traits\Relation
|
|||||||
* @var ModelInterface
|
* @var ModelInterface
|
||||||
*/
|
*/
|
||||||
protected mixed $model;
|
protected mixed $model;
|
||||||
|
|
||||||
|
|
||||||
protected mixed $value = 0;
|
protected mixed $value = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HasBase constructor.
|
* HasBase constructor.
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
public function __construct(public string $name)
|
public function __construct(public string $name)
|
||||||
{
|
{
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,16 +54,14 @@ abstract class HasBase implements \Database\Traits\Relation
|
|||||||
*/
|
*/
|
||||||
public function __call($name, $arguments)
|
public function __call($name, $arguments)
|
||||||
{
|
{
|
||||||
if (!method_exists($this, $name)) {
|
if ($name !== 'get') {
|
||||||
$relation = Kiri::getDi()->get(Relation::class);
|
return di(Relation::class)->getQuery($this->name)->$name(...$arguments);
|
||||||
$relation->getQuery($this->name)->$name(...$arguments);
|
|
||||||
} else {
|
} else {
|
||||||
call_user_func([$this, $name], ...$arguments);
|
return $this->get();
|
||||||
}
|
}
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
|||||||
Reference in New Issue
Block a user