Stud.IP
6.0
|
Public Member Functions | |
__construct (protected \Slim\App $app, protected ContainerInterface $container, protected FactoryInterface $factory, protected EncoderInterface $encoder, protected SchemaContainerInterface $schemaContainer, protected QueryParserInterface $queryParser, protected ResponseFactoryInterface $responseFactory, HeaderParametersParserInterface $headerParametersParser) | |
getUser (Request $request) | |
Protected Member Functions | |
getCodeResponse (int $statusCode, array $headers=[]) | |
getMetaResponse ($meta, $statusCode=ResponsesInterface::HTTP_OK, array $headers=[]) | |
getContentResponse ( $data, $statusCode=ResponsesInterface::HTTP_OK, $links=[], $meta=[], array $headers=[]) | |
getIdentifiersResponse ($data, $links=[], $meta=[], array $headers=[]) | |
getPaginatedIdentifiersResponse ( $data, $total, $links=[], $meta=[], array $headers=[]) | |
getCreatedResponse ($resource, $links=[], $meta=[], array $headers=[]) | |
getPaginatedContentResponse ( $data, $total, $statusCode=ResponsesInterface::HTTP_OK, $links=[], $meta=[], array $headers=[]) | |
getQueryParameters () | |
getOffsetAndLimit ($offsetDefault=0, $limitDefault=30) | |
getSchema ($resource) | |
getResponses (array $links=[], array $meta=[]) | |
Protected Attributes | |
$allowUnrecognizedParams = false | |
$allowedIncludePaths = [] | |
$allowedFieldSetTypes = null | |
$allowedSortFields = [] | |
$allowedPagingParameters = [] | |
$allowedFilteringParameters = [] | |
Ein JsonApiController ist die einfachste Möglichkeit, eine eigene JSON-API-Route zu erstellen.
Dazu erstellt man eine Unterklasse von JsonApiController und kann darin __invoke oder andere Methoden definieren und diese in der RouteMap registrieren.
Wenn man auf den JsonApiController verzichten möchte, muss man den JsonApiTrait in seiner eigenen Lösung einbinden und auÃerdem den Dependency Container als Instanzvariabel $this->container eintragen und die Methode JsonApiTrait::initJsonApiSupport aufrufen.
Diese Klasse hier übernimmt all diese Aufgaben selbst.
__construct | ( | protected \Slim\App | $app, |
protected ContainerInterface | $container, | ||
protected FactoryInterface | $factory, | ||
protected EncoderInterface | $encoder, | ||
protected SchemaContainerInterface | $schemaContainer, | ||
protected QueryParserInterface | $queryParser, | ||
protected ResponseFactoryInterface | $responseFactory, | ||
HeaderParametersParserInterface | $headerParametersParser | ||
) |
Der Konstruktor.
|
protected |
Get response with HTTP code only.
|
protected |
Get response with regular JSON API Document in body.
object | array | $data | |
int | $statusCode | |
array | null | $links | |
mixed | $meta |
|
protected |
object | $resource | |
array | null | $links | |
mixed | $meta |
|
protected |
Get response with only resource identifiers.
object | array | $data | |
array | null | $links | |
mixed | $meta |
|
protected |
Get response with meta information only.
array | object | $meta | Meta information |
int | $statusCode |
|
protected |
|
protected |
object | array | $data | |
?int | $total | |
int | $statusCode | |
array | null | $links | |
mixed | $meta |
|
protected |
Get response with paginated resource identifiers.
object | array | $data | |
?int | $total | |
array | null | $links | |
mixed | $meta |
|
protected |
|
protected |
|
protected |
Gibt das Schema zu einer beliebigen Ressource zurück.
mixed | $resource | die Ressource, zu der das Schema geliefert werden soll |
getUser | ( | Request | $request | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |