@@ -35,7 +35,9 @@ public function restGet($id, $queryParser) {
35
35
$ this ->preRestGet ($ queryParser , $ id );
36
36
37
37
if ($ queryParser ->isCount ()) {
38
- return $ this ->countAllResults ();
38
+ $ count = $ this ->distinct ('id ' )->countAllResults ();
39
+ Data::lastQuery ();
40
+ return $ count ;
39
41
}
40
42
41
43
if ($ queryParser ->hasLimit ()) $ this ->limit ($ queryParser ->getLimit ());
@@ -47,7 +49,7 @@ public function restGet($id, $queryParser) {
47
49
->groupBy ('id ' )
48
50
->find ();
49
51
50
- // Data::lastQuery();
52
+ Data::lastQuery ();
51
53
52
54
if ($ items ->exists ()) {
53
55
if ($ id ) {
@@ -210,8 +212,11 @@ public function applyFilter(QueryFilter $filter) {
210
212
* @param Entity $item
211
213
*/
212
214
public function applyRestGetOneRelations ($ item ) {
215
+ $ ignored = $ this ->ignoredRestGetOnRelations ();
213
216
/** @var RelationDef $relation */
214
217
foreach ($ this ->getRelations () as $ relation ) {
218
+ if (in_array ($ relation ->getName (), $ ignored )) continue ;
219
+ Data::debug (get_class ($ this ), "running " , $ relation ->getName ());
215
220
switch ($ relation ->getType ()) {
216
221
case RelationDef::HasOne:
217
222
$ relationName = $ relation ->getSimpleName ();
@@ -237,4 +242,8 @@ public function applyRestGetOneRelations($item) {
237
242
}
238
243
}
239
244
245
+ public function ignoredRestGetOnRelations () {
246
+ return [];
247
+ }
248
+
240
249
}
0 commit comments