blob: 9ce57289658e1d62362a46032ccd2b5c08bfeaee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?php
namespace JsonApi\Routes\StudyAreas;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use JsonApi\Errors\AuthorizationFailedException;
use JsonApi\Errors\RecordNotFoundException;
use JsonApi\JsonApiController;
class StudyAreasShow extends JsonApiController
{
protected $allowedIncludePaths = [
'children',
'courses',
'institute',
'parent',
];
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameters)
*/
public function __invoke(Request $request, Response $response, $args)
{
$studyArea = \StudipStudyArea::find($args['id']);
if (!$studyArea && $args['id'] !== 'root') {
throw new RecordNotFoundException();
}
return $this->getContentResponse($studyArea);
}
}
|