/**
  * @param RequestInterface $request
  * @throws JsonApiException
  */
 protected function checkRelationshipName(RequestInterface $request)
 {
     $name = $request->getRelationshipName();
     if (!in_array($name, $this->allowedRelationships(), true)) {
         throw new JsonApiException([], 404);
     }
 }
Ejemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function handle(ApiInterface $api, RequestInterface $request)
 {
     $interpreter = $api->getRequestInterpreter();
     $resourceType = $request->getResourceType();
     /** Check the relationship is acceptable */
     if ($request->getRelationshipName()) {
         $this->checkRelationshipName($request);
     }
     /** Check request parameters are acceptable */
     $this->checkQueryParameters($api, $request, $this->filterValidator($resourceType));
     /** Authorize the request */
     if ($this->authorizer) {
         $this->authorize($interpreter, $this->authorizer, $request);
     }
     /** Check the document content is acceptable */
     if ($this->validators) {
         $this->checkDocumentIsAcceptable($this->validators, $interpreter, $request);
     }
 }