1 | <?php |
||
35 | class RestController |
||
36 | { |
||
37 | /** |
||
38 | * @var DocumentModel |
||
39 | */ |
||
40 | private $model; |
||
41 | |||
42 | /** |
||
43 | * @var ContainerInterface service_container |
||
44 | */ |
||
45 | private $container; |
||
46 | |||
47 | /** |
||
48 | * @var Response |
||
49 | */ |
||
50 | private $response; |
||
51 | |||
52 | /** |
||
53 | * @var SchemaUtils |
||
54 | */ |
||
55 | private $schemaUtils; |
||
56 | |||
57 | /** |
||
58 | * @var RestUtils |
||
59 | */ |
||
60 | protected $restUtils; |
||
61 | |||
62 | /** |
||
63 | * @var Router |
||
64 | */ |
||
65 | private $router; |
||
66 | |||
67 | /** |
||
68 | * @var EngineInterface |
||
69 | */ |
||
70 | private $templating; |
||
71 | |||
72 | /** |
||
73 | * @var JsonPatchValidator |
||
74 | */ |
||
75 | private $jsonPatchValidator; |
||
76 | |||
77 | /** |
||
78 | * @var SecurityUtils |
||
79 | */ |
||
80 | protected $securityUtils; |
||
81 | |||
82 | /** @var CollectionCache */ |
||
83 | protected $collectionCache; |
||
84 | |||
85 | /** |
||
86 | * @param Response $response Response |
||
87 | * @param RestUtils $restUtils Rest Utils |
||
88 | * @param Router $router Router |
||
89 | * @param EngineInterface $templating Templating |
||
90 | * @param ContainerInterface $container Container |
||
91 | * @param SchemaUtils $schemaUtils Schema utils |
||
92 | * @param CollectionCache $cache Cache service |
||
93 | * @param JsonPatchValidator $jsonPatch Service for validation json patch |
||
94 | * @param SecurityUtils $security The securityUtils service |
||
95 | */ |
||
96 | public function __construct( |
||
117 | |||
118 | /** |
||
119 | * Get the container object |
||
120 | * |
||
121 | * @return \Symfony\Component\DependencyInjection\ContainerInterface |
||
122 | * |
||
123 | * @obsolete |
||
124 | */ |
||
125 | public function getContainer() |
||
129 | |||
130 | /** |
||
131 | * Returns a single record |
||
132 | * |
||
133 | * @param Request $request Current http request |
||
134 | * @param string $id ID of record |
||
135 | * |
||
136 | * @return \Symfony\Component\HttpFoundation\Response $response Response with result or error |
||
137 | */ |
||
138 | public function getAction(Request $request, $id) |
||
148 | |||
149 | /** |
||
150 | * Get the response object |
||
151 | * |
||
152 | * @return \Symfony\Component\HttpFoundation\Response $response Response object |
||
153 | */ |
||
154 | public function getResponse() |
||
158 | |||
159 | /** |
||
160 | * Return the model |
||
161 | * |
||
162 | * @throws \Exception in case no model was defined. |
||
163 | * |
||
164 | * @return DocumentModel $model Model |
||
165 | */ |
||
166 | public function getModel() |
||
174 | |||
175 | /** |
||
176 | * Set the model class |
||
177 | * |
||
178 | * @param DocumentModel $model Model class |
||
179 | * |
||
180 | * @return self |
||
181 | */ |
||
182 | public function setModel(DocumentModel $model) |
||
188 | |||
189 | /** |
||
190 | * Returns all records |
||
191 | * |
||
192 | * @param Request $request Current http request |
||
193 | * |
||
194 | * @return \Symfony\Component\HttpFoundation\Response $response Response with result or error |
||
195 | */ |
||
196 | public function allAction(Request $request) |
||
208 | |||
209 | /** |
||
210 | * Writes a new Entry to the database |
||
211 | * |
||
212 | * @param Request $request Current http request |
||
213 | * |
||
214 | * @return \Symfony\Component\HttpFoundation\Response $response Result of action with data (if successful) |
||
215 | */ |
||
216 | public function postAction(Request $request) |
||
242 | |||
243 | /** |
||
244 | * Get the router from the dic |
||
245 | * |
||
246 | * @return Router |
||
247 | */ |
||
248 | public function getRouter() |
||
252 | |||
253 | /** |
||
254 | * Update a record |
||
255 | * |
||
256 | * @param Number $id ID of record |
||
257 | * @param Request $request Current http request |
||
258 | * |
||
259 | * @throws MalformedInputException |
||
260 | * |
||
261 | * @return Response $response Result of action with data (if successful) |
||
262 | */ |
||
263 | public function putAction($id, Request $request) |
||
307 | |||
308 | /** |
||
309 | * Patch a record |
||
310 | * |
||
311 | * @param Number $id ID of record |
||
312 | * @param Request $request Current http request |
||
313 | * |
||
314 | * @throws MalformedInputException |
||
315 | * |
||
316 | * @return Response $response Result of action with data (if successful) |
||
317 | */ |
||
318 | public function patchAction($id, Request $request) |
||
366 | |||
367 | /** |
||
368 | * Deletes a record |
||
369 | * |
||
370 | * @param Number $id ID of record |
||
371 | * |
||
372 | * @return Response $response Result of the action |
||
373 | */ |
||
374 | public function deleteAction($id) |
||
382 | |||
383 | /** |
||
384 | * Return OPTIONS results. |
||
385 | * |
||
386 | * @param Request $request Current http request |
||
387 | * |
||
388 | * @throws SerializationException |
||
389 | * @return \Symfony\Component\HttpFoundation\Response $response Result of the action |
||
390 | */ |
||
391 | public function optionsAction(Request $request) |
||
412 | |||
413 | |||
414 | /** |
||
415 | * Return schema GET results. |
||
416 | * |
||
417 | * @param Request $request Current http request |
||
418 | * @param string $id ID of record |
||
419 | * |
||
420 | * @throws SerializationException |
||
421 | * @return \Symfony\Component\HttpFoundation\Response $response Result of the action |
||
422 | */ |
||
423 | public function schemaAction(Request $request, $id = null) |
||
458 | |||
459 | /** |
||
460 | * Renders a view. |
||
461 | * |
||
462 | * @param string $view The view name |
||
463 | * @param array $parameters An array of parameters to pass to the view |
||
464 | * @param Response $response A response instance |
||
465 | * |
||
466 | * @return Response A Response instance |
||
467 | */ |
||
468 | public function render($view, array $parameters = array(), Response $response = null) |
||
472 | |||
473 | |||
474 | /** |
||
475 | * Security needs to be enabled to get Object. |
||
476 | * |
||
477 | * @return String |
||
478 | * @throws UsernameNotFoundException |
||
479 | */ |
||
480 | public function getSecurityUser() |
||
484 | } |
||
485 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.