Skip to content

Commit 7a67f80

Browse files
committed
Реализовано клонирование объекта QueryRelationManager при создании сущности DataProvider
1 parent 1c075f1 commit 7a67f80

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"php": ">=7.2.0",
1515
"ext-pdo": "*",
1616
"yiisoft/yii2": "~2.0.0",
17-
"smoren/query-relation-manager": "2.0.1"
17+
"smoren/query-relation-manager": "2.0.2"
1818
},
1919
"autoload": {
2020
"psr-4": {

src/Yii2/QueryRelationDataProvider.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ class QueryRelationDataProvider extends BaseDataProvider
3838
*/
3939
public $withoutTotalCount = false;
4040

41+
/**
42+
* @inheritDoc
43+
*/
44+
public function init()
45+
{
46+
parent::init();
47+
48+
if(!($this->queryRelationManager instanceof QueryRelationManager)) {
49+
throw new QueryRelationManagerException(
50+
"param QueryRelationDataProvider::queryRelationManager is not an instance of QueryRelationManager"
51+
);
52+
}
53+
54+
$this->queryRelationManager = clone $this->queryRelationManager;
55+
}
56+
4157
/**
4258
* Prepares the data models that will be made available in the current page.
4359
* @return array the available data models

0 commit comments

Comments
 (0)