Skip to content

Commit 121bb56

Browse files
committed
use custom db connection in all()
1 parent a7b7801 commit 121bb56

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/QueryRelationManager.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace Smoren\Yii2\QueryRelationManager;
55

66

7+
use yii\db\Connection;
78
use yii\db\Query;
89

910
/**
@@ -197,14 +198,15 @@ public function modify(string $tableAlias, callable $modifier): self
197198

198199
/**
199200
* Выполняет запрос к базе, собирает и возвращает результат
201+
* @param Connection|null $db подключение к БД
200202
* @return array массив сущностей главной таблицы с отношениями подключенных таблиц
201203
* @throws QueryRelationManagerException
202204
*/
203-
public function all(): array
205+
public function all(?Connection $db = null): array
204206
{
205207
$this->prepare();
206208

207-
$rows = $this->query->all();
209+
$rows = $this->query->all($db);
208210

209211
$maps = [];
210212

0 commit comments

Comments
 (0)