|
- <?php
-
- namespace common\logic;
-
- use yii\db\ActiveQuery;
-
- class AbstractRepositoryQuery extends AbstractService implements RepositoryQueryInterface
- {
- protected ActiveQuery $query;
-
- public function __call(string $name, $params): self
- {
- call_user_func_array([$this->query, $name], $params);
-
- return $this;
- }
-
- public function find()
- {
- return $this->query->all();
- }
-
- public function findOne()
- {
- return $this->query->one();
- }
-
- public function filterById(int $id)
- {
- $this->query->andWhere(['id' => $id]);
- }
- }
|