phramework/jsonapi doc
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Namespaces

  • Phramework
    • JSONAPI
      • Controller
        • POST
      • Model
      • Viewers

Classes

  • Base
  • DELETE
  • GET
  • GETById
  • PATCH
  • POST
  • Relationships

Class Base

Common controller internal methods

Direct known subclasses

Phramework\JSONAPI\Controller\Relationships

Indirect known subclasses

Phramework\JSONAPI\Controller, Phramework\JSONAPI\Controller\DELETE, Phramework\JSONAPI\Controller\GET, Phramework\JSONAPI\Controller\GETById, Phramework\JSONAPI\Controller\PATCH, Phramework\JSONAPI\Controller\POST

Abstract
Namespace: Phramework\JSONAPI\Controller
License: Apache-2.0
Author: Xenofon Spafaridis nohponex@gmail.com
Since: 0.0.0
Located at Controller/Base.php

Methods summary

protected static
# view( array|object $parameters = [] )

Shortcut to \Phramework\Phramework::view.

Shortcut to \Phramework\Phramework::view.

Deprecated

since 1.0.0

Parameters

$parameters
Response parameters

Uses

\Phramework\Phramework::view
\Phramework\Phramework::view
protected static
# exists( mixed $assert, string $exceptionMessage = 'Resource not found' )

If !assert then a NotFoundException exceptions is thrown.

If !assert then a NotFoundException exceptions is thrown.

Parameters

$assert
$exceptionMessage

[Optional] Default is 'Resource not found'

Throws

Phramework\Exceptions\NotFoundException
protected static
# testUnknownError( mixed $assert, string $exceptionMessage = 'Unknown error' )

If !assert then a Exception exception is thrown.

If !assert then a Exception exception is thrown.

Parameters

$assert
$exceptionMessage
[Optional] Default is 'unknown_error'

Throws

Exception
public static boolean
# viewData( object $data, $links = null, $meta = null, $included = null )

View JSONAPI data

View JSONAPI data

Parameters

$data
$links
$meta
$included

Returns

boolean

Uses

\Phramework\Viewers\JSONAPI
protected static string[]
# getRequestInclude( object $parameters, string|null $modelClass = null )

Extract included related resources from parameters

Extract included related resources from parameters

Parameters

$parameters
Request parameters
$modelClass
If not null, will add additional include by default from resource model's relationships

Returns

string[]
protected static object
# getRequestAttributes( object $parameters )

Get request data attributes. The request is expected to have json api structure Like the following example:

[
   data => [
       'type' => 'user',
       'attributes' => [
           'email'    => 'nohponex@gmail.com',
           'password' => 'XXXXXXXXXXXXXXXXXX'
       ]
   ]
]

Get request data attributes. The request is expected to have json api structure Like the following example:

[ data => [ 'type' => 'user', 'attributes' => [ 'email'    => 'nohponex@gmail.com', 'password' => 'XXXXXXXXXXXXXXXXXX' ] ]
]

Parameters

$parameters
Request parameters

Returns

object

Uses

Request::requireParameters
protected static object|object[]
# getRequestData( object $parameters )

Get request primary data

Get request primary data

Parameters

$parameters
Request parameters

Returns

object|object[]

Uses

Request::requireParameters
protected static stdClass
# getRequestRelationships( object $parameters )

Get request relationships if any attributes.

Get request relationships if any attributes.

Parameters

$parameters
Request parameters

Returns

stdClass
public static
# checkIfUnsupportedRequestWithId( object|resource $resource )

Throw a Forbidden exception if resource's id is set. * Unsupported request to create a resource with a client-generated ID

Throw a Forbidden exception if resource's id is set. * Unsupported request to create a resource with a client-generated ID

Parameters

$resource

Throws

Phramework\Exceptions\ForbiddenException
phramework/jsonapi doc API documentation generated by ApiGen