2020 */
2121class GroupedSelection extends Selection
2222{
23- /** @var mixed current assigned referencing array */
24- public $ refCacheCurrent ;
25-
2623 /** @var Selection referenced table */
2724 protected $ refTable ;
2825
26+ /** @var mixed current assigned referencing array */
27+ protected $ refCacheCurrent ;
28+
2929 /** @var string grouping column name */
3030 protected $ column ;
3131
@@ -92,8 +92,7 @@ public function order(string $columns, ...$params)
9292 */
9393 public function aggregation (string $ function )
9494 {
95- $ selectQueryHash = $ this ->sqlBuilder ->getSelectQueryHash ($ this ->cache ->getPreviousAccessedColumns ());
96- $ aggregation = &$ this ->getRefTable ($ refPath )->aggregation [$ refPath . $ function . $ selectQueryHash ];
95+ $ aggregation = &$ this ->getRefTable ($ refPath )->aggregation [$ refPath . $ function . $ this ->sqlBuilder ->getSelectQueryHash ($ this ->getPreviousAccessedColumns ())];
9796
9897 if ($ aggregation === null ) {
9998 $ aggregation = [];
@@ -131,16 +130,16 @@ public function count(string $column = null): int
131130 protected function execute (): void
132131 {
133132 if ($ this ->rows !== null ) {
134- $ this ->cache -> setObserveCache ( $ this ) ;
133+ $ this ->observeCache = $ this ;
135134 return ;
136135 }
137136
138- $ accessedColumns = $ this ->cache -> getAccessedColumns () ;
137+ $ accessedColumns = $ this ->accessedColumns ;
139138 $ this ->loadRefCache ();
140139
141140 if (!isset ($ this ->refCacheCurrent ['data ' ])) {
142141 // we have not fetched any data yet => init accessedColumns by cached accessedColumns
143- $ this ->cache -> setAccessedColumns ( $ accessedColumns) ;
142+ $ this ->accessedColumns = $ accessedColumns ;
144143
145144 $ limit = $ this ->sqlBuilder ->getLimit ();
146145 $ rows = count ($ this ->refTable ->rows );
@@ -168,7 +167,7 @@ protected function execute(): void
168167 $ this ->data = &$ this ->refCacheCurrent ['data ' ][$ this ->active ];
169168 }
170169
171- $ this ->cache -> setObserveCache ( $ this ) ;
170+ $ this ->observeCache = $ this ;
172171 if ($ this ->data === null ) {
173172 $ this ->data = [];
174173 } else {
@@ -195,9 +194,12 @@ protected function getRefTable(&$refPath): Selection
195194
196195 protected function loadRefCache (): void
197196 {
198- $ referencing = &$ this ->refCache ->getReferencing ($ this ->cache ->getGeneralCacheKey ());
199- $ hash = $ this ->cache ->loadFromRefCache ($ referencing );
197+ $ hash = $ this ->getSpecificCacheKey ();
198+ $ referencing = &$ this ->refCache ['referencing ' ][$ this ->getGeneralCacheKey ()];
199+ $ this ->observeCache = &$ referencing ['observeCache ' ];
200200 $ this ->refCacheCurrent = &$ referencing [$ hash ];
201+ $ this ->accessedColumns = &$ referencing [$ hash ]['accessed ' ];
202+ $ this ->specificCacheKey = &$ referencing [$ hash ]['specificCacheKey ' ];
201203 $ this ->rows = &$ referencing [$ hash ]['rows ' ];
202204
203205 if (isset ($ referencing [$ hash ]['data ' ][$ this ->active ])) {
0 commit comments