|
@@ -31,13 +31,13 @@ discard block |
|
|
block discarded – undo |
|
31
|
31
|
return $e; |
|
32
|
32
|
} |
|
33
|
33
|
|
|
34
|
|
- public function collection($class, $groups, mixed $arguments = [], int $limit = 0, int $page = 1, array $orderby = []) |
|
|
34
|
+ public function collection($class, $groups, mixed $arguments = [], int $limit = 0, int $page = 1, array $orderby = []) |
|
35
|
35
|
{ |
|
36
|
36
|
$response = $this->getBasicResponse($class); |
|
37
|
37
|
|
|
38
|
|
- $response['hydra:member'] = $this->getMembers($class, $groups, $arguments, $limit, $page, $orderby); |
|
39
|
|
- $response['hydra:search'] = $this->getSearch($class); |
|
40
|
|
- $response['hydra:totalItems'] = $this->getCount($class, $arguments); |
|
|
38
|
+ $response['hydra:member'] = $this->getMembers($class, $groups, $arguments, $limit, $page, $orderby); |
|
|
39
|
+ $response['hydra:search'] = $this->getSearch($class); |
|
|
40
|
+ $response['hydra:totalItems'] = $this->getCount($class, $arguments); |
|
41
|
41
|
|
|
42
|
42
|
return $response; |
|
43
|
43
|
} |
|
@@ -47,8 +47,8 @@ discard block |
|
|
block discarded – undo |
|
47
|
47
|
//$response = $this->getBasicResponse($class); |
|
48
|
48
|
//$response['hydra:search'] = $this->getSearch($class); |
|
49
|
49
|
|
|
50
|
|
- $response['hydra:member'] = $result; |
|
51
|
|
- $response['hydra:totalItems'] = count($response['hydra:member']); |
|
|
50
|
+ $response['hydra:member'] = $result; |
|
|
51
|
+ $response['hydra:totalItems'] = count($response['hydra:member']); |
|
52
|
52
|
|
|
53
|
53
|
return $response; |
|
54
|
54
|
} |
|
@@ -71,8 +71,8 @@ discard block |
|
|
block discarded – undo |
|
71
|
71
|
$className = substr($class, strrpos($class, '\\') + 1); |
|
72
|
72
|
|
|
73
|
73
|
$response['@id'] = '/' . strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $className)) . 's'; |
|
74
|
|
- $response['@context'] = "/contexts/" . $className; |
|
75
|
|
- $response['@type'] = "hydra:Collection"; |
|
|
74
|
+ $response['@context'] = "/contexts/" . $className; |
|
|
75
|
+ $response['@type'] = "hydra:Collection"; |
|
76
|
76
|
|
|
77
|
77
|
$response['hydra:view'] = [ |
|
78
|
78
|
'@id' => $this->uri, |
|
@@ -90,7 +90,7 @@ discard block |
|
|
block discarded – undo |
|
90
|
90
|
if ($page == 1) |
|
91
|
91
|
$offset = (($page = $this->request->get('page') ?: 1) - 1) * $limit; |
|
92
|
92
|
|
|
93
|
|
- $data = $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset); |
|
|
93
|
+ $data = $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset); |
|
94
|
94
|
|
|
95
|
95
|
return $this->serialize($data, ['groups' => $groups]); |
|
96
|
96
|
} |