|
@@ -16,7 +16,7 @@ class TodosController {
|
|
|
return $app->json(array_values($todos));
|
|
|
}
|
|
|
|
|
|
- public function get(Application $app, $id) {
|
|
|
+ public function getLevel1(Application $app, $id) {
|
|
|
/** @var \Model $model */
|
|
|
$model = $app['model'];
|
|
|
$todos = $model->load();
|
|
@@ -24,6 +24,16 @@ class TodosController {
|
|
|
return $app->json($todo);
|
|
|
}
|
|
|
|
|
|
+ public function getLevel2(Application $app, $id) {
|
|
|
+ /** @var \Model $model */
|
|
|
+ $model = $app['model'];
|
|
|
+ $todos = $model->load();
|
|
|
+ $todo = $todos[$id]
|
|
|
+ ? ['todo' => $todos[$id]]
|
|
|
+ : NULL;
|
|
|
+ return $app->json($todo);
|
|
|
+ }
|
|
|
+
|
|
|
public function put(Application $app, Request $request, int $id) {
|
|
|
$sub = Request::create('/todos', 'POST', [], [], [], [], $request->getContent());
|
|
|
return $app->handle($sub, HttpKernelInterface::SUB_REQUEST);
|