Methods

Constructor

__construct(string $class, array $options) 

Sets the class, and passes any options provided to the appropriate setter methods, after first converting them to lowercase and stripping underscores.

If the class does not exist, raises an exception.

Parameters

$class

string

$options

array

Exceptions

\PhlyRestfully\Exception\InvalidArgumentException

Retrieve the class this metadata is associated with

getClass() : string

Returns

string

Retrieve the hydrator to associate with this class, if any

getHydrator() : null | \Zend\Hydrator\HydratorInterface

Returns

null\Zend\Hydrator\HydratorInterface

Retrieve the identifier name

getIdentifierName() : string

Returns

string

Retrieve the resource route

getResourceRoute() : null | string

If not set, uses the route or url, depending on which is present.

Returns

nullstring

Retrieve the route to use for URL generation

getRoute() : null | string

Returns

nullstring

Retrieve an route options to use in URL generation

getRouteOptions() : array

Returns

array

Retrieve any route parameters to use in URL generation

getRouteParams() : array

Returns

array

Retrieve the URL to use for this resource, if present

getUrl() : null | string

Returns

nullstring

Is a hydrator associated with this class?

hasHydrator() : bool

Returns

bool

Is a route present for this class?

hasRoute() : bool

Returns

bool

Is a URL set for this class?

hasUrl() : bool

Returns

bool

Does this class represent a collection?

isCollection() : bool

Returns

bool

Set the hydrator to use with this class

setHydrator(string | \Zend\Hydrator\HydratorInterface $hydrator) : \PhlyRestfully\Metadata
fluent This method is part of a fluent interface and will return the same instance

Parameters

$hydrator

string\Zend\Hydrator\HydratorInterface

Exceptions

\PhlyRestfully\Exception\InvalidArgumentException if the class or hydrator does not implement HydratorInterface

Returns

Set the identifier name

setIdentifierName(string | mixed $identifier) : \PhlyRestfully\Metadata
fluent This method is part of a fluent interface and will return the same instance

Parameters

$identifier

stringmixed

Returns

Set the flag indicating collection status

setIsCollection(bool $flag) : \PhlyRestfully\Metadata
fluent This method is part of a fluent interface and will return the same instance

Parameters

$flag

bool

Returns

Set the resource route (for embedded resources in collections)

setResourceRoute(string $route) : \PhlyRestfully\Metadata
fluent This method is part of a fluent interface and will return the same instance

Parameters

$route

string

Returns

Set the route for URL generation

setRoute(string $route) : \PhlyRestfully\Metadata
fluent This method is part of a fluent interface and will return the same instance

Parameters

$route

string

Returns

Set route options for URL generation

setRouteOptions(array $options) : \PhlyRestfully\Metadata
fluent This method is part of a fluent interface and will return the same instance

Parameters

$options

array

Returns

Set route parameters for URL generation

setRouteParams(array $params) : \PhlyRestfully\Metadata
fluent This method is part of a fluent interface and will return the same instance

Parameters

$params

array

Returns

Set the URL to use with this resource

setUrl(string $url) : \PhlyRestfully\Metadata
fluent This method is part of a fluent interface and will return the same instance

Parameters

$url

string

Returns