1
|
|
|
<?php |
2
|
|
|
namespace keeko\core\responder; |
3
|
|
|
|
4
|
|
|
use keeko\framework\domain\payload\PayloadInterface; |
5
|
|
|
use Symfony\Component\HttpFoundation\Request; |
6
|
|
|
use Symfony\Component\HttpFoundation\JsonResponse; |
7
|
|
|
use keeko\framework\foundation\AbstractPayloadResponder; |
8
|
|
|
use keeko\core\model\Application; |
9
|
|
|
use Tobscure\JsonApi\Document; |
10
|
|
|
use Tobscure\JsonApi\Collection; |
11
|
|
|
use Tobscure\JsonApi\Parameters; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Automatically generated JsonResponder for List all applications |
15
|
|
|
* |
16
|
|
|
* @author gossi |
17
|
|
|
*/ |
18
|
|
|
class ApplicationListJsonResponder extends AbstractPayloadResponder { |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @param Request $request |
22
|
|
|
* @param PayloadInterface $payload |
23
|
|
|
*/ |
24
|
|
|
public function found(Request $request, PayloadInterface $payload) { |
25
|
|
|
$params = new Parameters($request->query->all()); |
26
|
|
|
$data = $payload->Model(); |
|
|
|
|
27
|
|
|
$serializer = Application::getSerializer(); |
28
|
|
|
$resource = new Collection($data, $serializer); |
29
|
|
|
$resource = $resource->with($params->getInclude([])); |
30
|
|
|
$resource = $resource->fields($params->getFields([ |
|
|
|
|
31
|
|
|
'application' => Application::getSerializer()->getFields() |
32
|
|
|
])); |
33
|
|
|
$document = new Document($resource); |
34
|
|
|
|
35
|
|
|
// meta |
36
|
|
|
$document->setMeta([ |
37
|
|
|
'total' => $data->getNbResults(), |
38
|
|
|
'first' => $data->getFirstPage(), |
39
|
|
|
'next' => $data->getNextPage(), |
40
|
|
|
'previous' => $data->getPreviousPage(), |
41
|
|
|
'last' => $data->getLastPage() |
42
|
|
|
]); |
43
|
|
|
|
44
|
|
|
// return response |
45
|
|
|
return new JsonResponse($document->toArray()); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
*/ |
50
|
|
|
protected function getPayloadMethods() { |
51
|
|
|
return [ |
52
|
|
|
'keeko\framework\domain\payload\Found' => 'found' |
53
|
|
|
]; |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.