This commit is contained in:
2023-04-16 14:41:20 +08:00
parent 0bf69d576d
commit 64d3f31138
5 changed files with 9 additions and 10 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ class ActiveQuery extends Component implements ISqlBuilder
$this->modelClass = $model; $this->modelClass = $model;
$this->builder = SqlBuilder::builder($this); $this->builder = SqlBuilder::builder($this);
parent::__construct($config); parent::__construct();
} }
+1 -1
View File
@@ -65,7 +65,7 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
$this->query = $query; $this->query = $query;
$this->model = $model; $this->model = $model;
parent::__construct([]); parent::__construct();
} }
+5 -6
View File
@@ -87,12 +87,11 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
/** /**
* @param array $config
* @throws Exception * @throws Exception
*/ */
public function __construct(array $config = []) public function __construct()
{ {
parent::__construct($config); parent::__construct();
$this->init(); $this->init();
} }
@@ -149,10 +148,10 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
/** /**
* @throws Exception * @throws Exception
*/ */
public function init() public function init(): void
{ {
$an = Kiri::getDi()->get(Annotation::class); $container = Kiri::getDi();
$an->injectProperty($this); $container->resolveProperties($container->getReflectionClass(get_called_class()), $this);
} }
+1 -1
View File
@@ -86,7 +86,7 @@ class Connection extends Component
*/ */
public function __construct(public EventProvider $eventProvider, public Pool $connections, public ContainerInterface $container, array $config = []) public function __construct(public EventProvider $eventProvider, public Pool $connections, public ContainerInterface $container, array $config = [])
{ {
parent::__construct($config); parent::__construct();
} }
+1 -1
View File
@@ -42,7 +42,7 @@ class Pagination extends Component
*/ */
public function __construct(ActiveQuery $activeQuery, array $config = []) public function __construct(ActiveQuery $activeQuery, array $config = [])
{ {
parent::__construct($config); parent::__construct();
$this->activeQuery = $activeQuery; $this->activeQuery = $activeQuery;
} }