Class ArraySerializable

Summary

Fully Qualified Name: Laminas\Hydrator\ArraySerializable
Extends: ArraySerializableHydrator

Description

Methods

Name Description Defined By
addFilter() Add a new filter to take care of what needs to be hydrated. AbstractHydrator
addStrategy() Adds the given strategy under the given name. AbstractHydrator
extract() Extract values from the provided object ArraySerializableHydrator
extractName() Convert a name for extraction. If no naming strategy exists, the plain value is returned. AbstractHydrator
extractValue() Converts a value for extraction. If no strategy exists the plain value is returned. AbstractHydrator
getFilter() Get the filter instance AbstractHydrator
getNamingStrategy() Gets the naming strategy. AbstractHydrator
getStrategy() Gets the strategy with the given name. AbstractHydrator
hasFilter() Check whether a specific filter exists at key $name or not AbstractHydrator
hasNamingStrategy() Checks if a naming strategy exists. AbstractHydrator
hasStrategy() Checks if the strategy with the given name exists. AbstractHydrator
hydrate() Hydrate an object ArraySerializableHydrator
hydrateName() Converts a value for hydration. If no naming strategy exists, the plain value is returned. AbstractHydrator
hydrateValue() Converts a value for hydration. If no strategy exists the plain value is returned. AbstractHydrator
removeFilter() Remove a filter from the composition. AbstractHydrator
removeNamingStrategy() Removes the naming strategy AbstractHydrator
removeStrategy() Removes the strategy with the given name. AbstractHydrator
setNamingStrategy() Adds the given naming strategy AbstractHydrator

Method Details

addFilter()

Add a new filter to take care of what needs to be hydrated.

To exclude e.g. the method getServiceLocator:

$composite->addFilter("servicelocator",

function ($property) {
    list($class, $method) = explode('::', $property);
    if ($method === 'getServiceLocator') {
        return false;
    }
    return true;
}, FilterComposite::CONDITION_AND

);

Parameter Name Type Description
$name string Index
$filter callable|\Filter\FilterInterface
$condition

Returns:

addStrategy()

Adds the given strategy under the given name.

Parameter Name Type Description
$name string The
$strategy \Strategy\StrategyInterface The

Returns:

extract()

Extract values from the provided object

Extracts values via the object's getArrayCopy() method.

{@inheritDoc}

Parameter Name Type Description
$object

Returns:

extractName()

Convert a name for extraction. If no naming strategy exists, the plain value is returned.

Parameter Name Type Description
$name string The
$object null|object The

Returns: mixed

extractValue()

Converts a value for extraction. If no strategy exists the plain value is returned.

Parameter Name Type Description
$name string The
$value mixed The
$object null|object The

Returns: mixed

getFilter()

Get the filter instance

Returns:

getNamingStrategy()

Gets the naming strategy.

If no naming strategy is registered, registers the IdentityNamingStrategy, which acts essentially as a no-op.

{@inheritDoc}

Returns:

getStrategy()

Gets the strategy with the given name.

Parameter Name Type Description
$name string The

Returns:

hasFilter()

Check whether a specific filter exists at key $name or not

Parameter Name Type Description
$name string Index/name

Returns:

hasNamingStrategy()

Checks if a naming strategy exists.

Returns:

hasStrategy()

Checks if the strategy with the given name exists.

Parameter Name Type Description
$name string The

Returns:

hydrate()

Hydrate an object

Hydrates an object by passing $data to either its exchangeArray() or populate() method.

{@inheritDoc}

Parameter Name Type Description
$data
$object

Returns:

hydrateName()

Converts a value for hydration. If no naming strategy exists, the plain value is returned.

Parameter Name Type Description
$name string The
$data null|array The

Returns:

hydrateValue()

Converts a value for hydration. If no strategy exists the plain value is returned.

Parameter Name Type Description
$name string The
$value mixed The
$data null|array The

Returns: mixed

removeFilter()

Remove a filter from the composition.

To not extract "has" methods, unregister the filter.

$filterComposite->removeFilter('has');

Parameter Name Type Description
$name

Returns:

removeNamingStrategy()

Removes the naming strategy

Returns:

removeStrategy()

Removes the strategy with the given name.

Parameter Name Type Description
$name string The

Returns:

setNamingStrategy()

Adds the given naming strategy

Parameter Name Type Description
$strategy \NamingStrategy\NamingStrategyInterface The

Returns:

Top