BEdita API doc | 4-cactus
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Download

Namespaces

  • BEdita
    • API
      • Auth
      • Controller
        • Admin
        • Component
        • Model
      • Error
      • Event
      • Exception
      • Middleware
      • Model
        • Action
      • Network
        • Exception
      • Shell
      • TestSuite
      • Utility
    • Core
      • Configure
        • Engine
      • Database
        • Type
      • Exception
      • Filesystem
        • Adapter
        • Exception
        • Thumbnail
      • I18n
      • Job
        • Service
      • Mailer
        • Preview
        • Transport
      • Model
        • Action
        • Behavior
        • Entity
        • Table
        • Validation
      • ORM
        • Inheritance
        • Locator
        • Rule
      • Shell
        • Task
      • State
      • TestSuite
        • Fixture
      • Utility

Classes

  • JsonApi

Class JsonApi

JSON API formatter API.

Namespace: BEdita\API\Utility
Since: 4.0.0
Located at API/src/Utility/JsonApi.php

Methods summary

public static array
# formatData( BEdita\Core\Utility\JsonApiSerializable|BEdita\Core\Utility\JsonApiSerializable[]|null $items, integer $options = 0, array $fields = [], array & $included = [] )

Format single or multiple data items in JSON API format.

Format single or multiple data items in JSON API format.

Two events will be dispatched: - beforeFormatData dispatched before the formatting of $items - afterFormatData dispatched after the formatting of $items

Parameters

$items
Items to be formatted.
$options
Serializer options.
$fields
Selected fields to view in attributes and meta, if empty (default) all fields are serialized
$included
Array to be populated with included resources.

Returns

array

Throws

InvalidArgumentException

Throws an exception if $item could not be converted to array, or if required key id is unset or empty.

protected static mixed
# dispatchEvent( BEdita\API\Utility\string $eventName, array $data )

Create and dispatch an event. Return $data if the event result is null.

Create and dispatch an event. Return $data if the event result is null.

Parameters

$eventName
The event name
$data
Data dispatched with the event

Returns

mixed
protected static array
# metaSchema( array $types )

Create meta schema info for types

Create meta schema info for types

Parameters

$types
Type names array

Returns

array
public static array|null
# schemaInfo( string $type )

Get JSON Schema info for a $type: URL and revision.

Get JSON Schema info for a $type: URL and revision.

Parameters

$type
Type name

Returns

array|null
Schema info array or null if no suitable schema is found
public static array
# parseData( array $data )

Parse single or multiple data items from JSON API format.

Parse single or multiple data items from JSON API format.

Parameters

$data
Items to be parsed.

Returns

array

Throws

InvalidArgumentException
Throws an exception if one of required keys id and type is unset or empty.
protected static array
# parseItem( array $item )

Parse single data item from JSON API format.

Parse single data item from JSON API format.

Parameters

$item
Item to be parsed.

Returns

array

Throws

InvalidArgumentException
Throws an exception if one of required keys id and type is unset or empty.
BEdita API doc | 4-cactus API documentation generated by ApiGen