File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 13
13
"require" : {
14
14
"php" : " >=7.2.0" ,
15
15
"ext-pdo" : " *" ,
16
- "yiisoft/yii2" : " ~2.0.0"
16
+ "yiisoft/yii2" : " ~2.0.0" ,
17
+ "smoren/query-relation-manager" : " 1.0.0"
17
18
},
18
19
"autoload" : {
19
20
"psr-4" : {
Original file line number Diff line number Diff line change 4
4
namespace Smoren \Yii2 \QueryRelationManager \ActiveRecord ;
5
5
6
6
7
+ use Smoren \Yii2 \QueryRelationManager \Base \QueryRelationManagerException ;
7
8
use yii \data \BaseDataProvider ;
8
9
use yii \db \Connection ;
9
10
use yii \db \Query ;
@@ -27,6 +28,11 @@ class QueryRelationDataProvider extends BaseDataProvider
27
28
*/
28
29
public $ key ;
29
30
31
+ /**
32
+ * @var bool Не считать totalCount
33
+ */
34
+ public $ withoutTotalCount = false ;
35
+
30
36
/**
31
37
* Prepares the data models that will be made available in the current page.
32
38
* @return array the available data models
@@ -93,7 +99,10 @@ protected function prepareKeys($models)
93
99
*/
94
100
protected function prepareTotalCount ()
95
101
{
96
- // TODO слабое место: сильно снижает производительность!!! Возможно необходимо сделать рассчет опциональным
102
+ if ($ this ->withoutTotalCount ) {
103
+ return 0 ;
104
+ }
105
+
97
106
return $ this ->queryRelationManager
98
107
->prepare ()
99
108
->getQuery ()
You can’t perform that action at this time.
0 commit comments