改名
This commit is contained in:
@@ -15,13 +15,15 @@ class HasCount extends HasBase
|
|||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param $arguments
|
* @param $arguments
|
||||||
* @return $this
|
* @return ActiveQuery
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function __call($name, $arguments): static
|
public function __call($name, $arguments): mixed
|
||||||
{
|
{
|
||||||
$this->_relation->getQuery($this->model::className())->$name(...$arguments);
|
if (method_exists($this, $name)) {
|
||||||
return $this;
|
return call_user_func([$this, $name], ...$arguments);
|
||||||
|
}
|
||||||
|
return $this->_relation->getQuery($this->model::className())->$name(...$arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,13 +22,14 @@ class HasMany extends HasBase
|
|||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param $arguments
|
* @param $arguments
|
||||||
* @return static
|
* @return ActiveQuery
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function __call($name, $arguments): static
|
public function __call($name, $arguments): mixed
|
||||||
{
|
{
|
||||||
$this->_relation->getQuery($this->model::className())->$name(...$arguments);
|
if (method_exists($this, $name)) {
|
||||||
return $this;
|
return call_user_func([$this, $name], ...$arguments);
|
||||||
|
}
|
||||||
|
return $this->_relation->getQuery($this->model::className())->$name(...$arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+7
-5
@@ -6,6 +6,7 @@
|
|||||||
* Time: 13:47
|
* Time: 13:47
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Database;
|
namespace Database;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
@@ -21,13 +22,14 @@ class HasOne extends HasBase
|
|||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param $arguments
|
* @param $arguments
|
||||||
* @return $this
|
* @return ActiveQuery
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function __call($name, $arguments): static
|
public function __call($name, $arguments): mixed
|
||||||
{
|
{
|
||||||
$this->_relation->getQuery($this->model::className())->$name(...$arguments);
|
if (method_exists($this, $name)) {
|
||||||
return $this;
|
return call_user_func([$this, $name], ...$arguments);
|
||||||
|
}
|
||||||
|
return $this->_relation->getQuery($this->model::className())->$name(...$arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user