@@ -31,13 +31,13 @@ discard block |
||
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,15 +47,15 @@ discard block |
||
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 | } |
55 | 55 | |
56 | 56 | public function item($class, $id, $groups) |
57 | 57 | { |
58 | - $data = $this->manager->getRepository($class)->find(preg_replace("/[^0-9]/", "", $id)); |
|
58 | + $data = $this->manager->getRepository($class)->find(preg_replace("/[^0-9]/", "", $id)); |
|
59 | 59 | $analisesSerialized = $this->serializer->serialize($data, 'jsonld', ['groups' => $groups]); |
60 | 60 | return json_decode($analisesSerialized); |
61 | 61 | } |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $className = substr($class, strrpos($class, '\\') + 1); |
66 | 66 | |
67 | 67 | $response['@id'] = '/' . strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $className)) . 's'; |
68 | - $response['@context'] = "/contexts/" . $className; |
|
69 | - $response['@type'] = "hydra:Collection"; |
|
68 | + $response['@context'] = "/contexts/" . $className; |
|
69 | + $response['@type'] = "hydra:Collection"; |
|
70 | 70 | |
71 | 71 | $response['hydra:view'] = [ |
72 | 72 | '@id' => $this->uri, |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | if ($page == 1) |
85 | 85 | $offset = (($page = $this->request->get('page') ?: 1) - 1) * $limit; |
86 | 86 | |
87 | - $data = $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset); |
|
87 | + $data = $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset); |
|
88 | 88 | |
89 | 89 | return $this->serialize($data, ['groups' => $groups]); |
90 | 90 | } |