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

Namespaces

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

Classes

  • Cache
  • Directives
  • Get
  • Model
  • Relationship

Class Relationship

Phramework\JSONAPI\Model\Model
Extended by Phramework\JSONAPI\Model\Cache
Extended by Phramework\JSONAPI\Model\Directives
Extended by Phramework\JSONAPI\Model\Get
Extended by Phramework\JSONAPI\Model\Relationship

Direct known subclasses

Phramework\JSONAPI\Model

Abstract
Namespace: Phramework\JSONAPI\Model
License: Apache-2.0
Author: Xenofon Spafaridis nohponex@gmail.com
Since: 1.0.0
Located at Model/Relationship.php

Methods summary

public static object
# getRelationships( )

Get resource's relationships

Get resource's relationships

Returns

object
Object with Relationship objects as values
public static
# getRelationship( $relationshipKey )
public static Boolean
# relationshipExists( string $relationshipKey )

Check if relationship exists

Check if relationship exists

Parameters

$relationshipKey
Relationship's key (alias)

Returns

Boolean
public static Phramework\JSONAPI\RelationshipResource|Phramework\JSONAPI\RelationshipResource[]
# getRelationshipData( string $relationshipKey, string $id, Phramework\JSONAPI\Fields $fields = null, $primaryDataParameters = [], $relationshipParameters = [] )

Get records from a relationship link

Get records from a relationship link

Parameters

$relationshipKey
$id
$fields
$primaryDataParameters
$relationshipParameters

Returns

Phramework\JSONAPI\RelationshipResource|Phramework\JSONAPI\RelationshipResource[]

Throws

Phramework\Exceptions\ServerException
If relationship doesn't exist
Phramework\Exceptions\ServerException

If relationship's class method is not defined

public static Phramework\JSONAPI\Resource[]
# getIncludedData( Phramework\JSONAPI\Resource|Phramework\JSONAPI\Resource[] $primaryData, string[] $include = [], Phramework\JSONAPI\Fields $fields = null, array $additionalResourceParameters = [] )

Get jsonapi's included object, selected by include argument, using id's of relationship's data from resources in primary data object

Get jsonapi's included object, selected by include argument, using id's of relationship's data from resources in primary data object

Parameters

$primaryData
Primary data resource or resources
$include
An array with the keys of relationships to include
$fields
$additionalResourceParameters
[Optional]

Returns

Phramework\JSONAPI\Resource[]
An array with all included related data

Throws

Phramework\Exceptions\RequestException
When a relationship is not found
Phramework\Exceptions\ServerException

Todo

handle Relationship resource cannot be accessed
include second level relationships
multiple (batch) getById at once

Methods inherited from Phramework\JSONAPI\Model\Get

get(), getById(), parseFields(), parseFilter(), parsePage(), parseSort()

Methods inherited from Phramework\JSONAPI\Model\Directives

handleFilter(), handleGet()

Methods inherited from Phramework\JSONAPI\Model\Cache

getCache(), initializeCache(), invalidateCache(), setCache()

Methods inherited from Phramework\JSONAPI\Model\Model

getCast(), getEndpoint(), getIdAttribute(), getSchema(), getSelfLink(), getTable(), getType()

Constants summary

Constants inherited from Phramework\JSONAPI\Model\Model

GET_BY_PREFIX, GET_RELATIONSHIP_BY_PREFIX, POST_RELATIONSHIP_BY_PREFIX

Properties summary

Properties inherited from Phramework\JSONAPI\Model\Cache

$cache

Properties inherited from Phramework\JSONAPI\Model\Model

$cast, $endpoint, $idAttribute, $schema, $table, $type

phramework/jsonapi doc API documentation generated by ApiGen