|
@@ -31,23 +31,23 @@ discard block |
|
|
block discarded – undo |
|
31
|
31
|
return $e; |
|
32
|
32
|
} |
|
33
|
33
|
|
|
34
|
|
- public function collectionData($data, $class, $groups, mixed $arguments = []) |
|
|
34
|
+ public function collectionData($data, $class, $groups, mixed $arguments = []) |
|
35
|
35
|
{ |
|
36
|
36
|
$response = $this->getBasicResponse($class); |
|
37
|
37
|
|
|
38
|
|
- $response['hydra:member'] = $this->data($data, $groups); |
|
39
|
|
- $response['hydra:search'] = $this->getSearch($class); |
|
40
|
|
- $response['hydra:totalItems'] = $this->getCount($class, $arguments); |
|
|
38
|
+ $response['hydra:member'] = $this->data($data, $groups); |
|
|
39
|
+ $response['hydra:search'] = $this->getSearch($class); |
|
|
40
|
+ $response['hydra:totalItems'] = $this->getCount($class, $arguments); |
|
41
|
41
|
|
|
42
|
42
|
return $response; |
|
43
|
43
|
} |
|
44
|
|
- public function collection($class, $groups, mixed $arguments = [], int $limit = 0, int $page = 1, array $orderby = []) |
|
|
44
|
+ public function collection($class, $groups, mixed $arguments = [], int $limit = 0, int $page = 1, array $orderby = []) |
|
45
|
45
|
{ |
|
46
|
46
|
$response = $this->getBasicResponse($class); |
|
47
|
47
|
|
|
48
|
|
- $response['hydra:member'] = $this->getMembers($class, $groups, $arguments, $limit, $page, $orderby); |
|
49
|
|
- $response['hydra:search'] = $this->getSearch($class); |
|
50
|
|
- $response['hydra:totalItems'] = $this->getCount($class, $arguments); |
|
|
48
|
+ $response['hydra:member'] = $this->getMembers($class, $groups, $arguments, $limit, $page, $orderby); |
|
|
49
|
+ $response['hydra:search'] = $this->getSearch($class); |
|
|
50
|
+ $response['hydra:totalItems'] = $this->getCount($class, $arguments); |
|
51
|
51
|
|
|
52
|
52
|
return $response; |
|
53
|
53
|
} |
|
@@ -57,8 +57,8 @@ discard block |
|
|
block discarded – undo |
|
57
|
57
|
//$response = $this->getBasicResponse($class); |
|
58
|
58
|
//$response['hydra:search'] = $this->getSearch($class); |
|
59
|
59
|
|
|
60
|
|
- $response['hydra:member'] = $result; |
|
61
|
|
- $response['hydra:totalItems'] = count($response['hydra:member']); |
|
|
60
|
+ $response['hydra:member'] = $result; |
|
|
61
|
+ $response['hydra:totalItems'] = count($response['hydra:member']); |
|
62
|
62
|
|
|
63
|
63
|
return $response; |
|
64
|
64
|
} |
|
@@ -81,8 +81,8 @@ discard block |
|
|
block discarded – undo |
|
81
|
81
|
$className = substr($class, strrpos($class, '\\') + 1); |
|
82
|
82
|
|
|
83
|
83
|
$response['@id'] = '/' . strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $className)) . 's'; |
|
84
|
|
- $response['@context'] = "/contexts/" . $className; |
|
85
|
|
- $response['@type'] = "hydra:Collection"; |
|
|
84
|
+ $response['@context'] = "/contexts/" . $className; |
|
|
85
|
+ $response['@type'] = "hydra:Collection"; |
|
86
|
86
|
|
|
87
|
87
|
$response['hydra:view'] = [ |
|
88
|
88
|
'@id' => $this->uri, |
|
@@ -100,7 +100,7 @@ discard block |
|
|
block discarded – undo |
|
100
|
100
|
if ($page == 1) |
|
101
|
101
|
$offset = (($page = $this->request->get('page') ?: 1) - 1) * $limit; |
|
102
|
102
|
|
|
103
|
|
- $data = $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset); |
|
|
103
|
+ $data = $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset); |
|
104
|
104
|
|
|
105
|
105
|
return $this->serialize($data, ['groups' => $groups]); |
|
106
|
106
|
} |