变更
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ class HasCount extends HasBase
|
||||
public function get(): array|ModelInterface|null
|
||||
{
|
||||
$relation = Kiri::getDi()->get(Relation::class);
|
||||
return $relation->getQuery($this->name)->count();
|
||||
return $relation->get($this->name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,6 +29,6 @@ class HasMany extends HasBase
|
||||
public function get(): array|Collection|null
|
||||
{
|
||||
$relation = Kiri::getDi()->get(Relation::class);
|
||||
return $relation->getQuery($this->name)->get();
|
||||
return $relation->get($this->name);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,6 +28,6 @@ class HasOne extends HasBase
|
||||
public function get(): array|ModelInterface|null
|
||||
{
|
||||
$relation = Kiri::getDi()->get(Relation::class);
|
||||
return $relation->getQuery($this->name)->first();
|
||||
return $relation->first($this->name);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
namespace Database;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Di\Context;
|
||||
|
||||
@@ -14,8 +15,6 @@ use Kiri\Di\Context;
|
||||
class Relation extends Component
|
||||
{
|
||||
|
||||
private array $_relations = [];
|
||||
|
||||
/** @var ActiveQuery[] $_query */
|
||||
private array $_query = [];
|
||||
|
||||
@@ -52,6 +51,7 @@ class Relation extends Component
|
||||
/**
|
||||
* @param string $_identification
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function first(string $_identification): mixed
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user