package Default
inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator

 Methods

Initializes a new instance of this class.

__construct() 
Inherited

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

addFilter(string $name, callable|\Zend\Stdlib\Hydrator\Filter\FilterInterface $filter, integer $condition = \Zend\Stdlib\Hydrator\Filter\FilterComposite::CONDITION_OR) : \Zend\Stdlib\Hydrator\Filter\FilterComposite
Inherited

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 );

inherited_from \Zend\Stdlib\Hydrator\FilterEnabledInterface::addFilter()

Parameters

$name

string

Index in the composite

$filter

callable\Zend\Stdlib\Hydrator\Filter\FilterInterface

$condition

integer

Returns

\Zend\Stdlib\Hydrator\Filter\FilterComposite

Adds the given strategy under the given name.

addStrategy(string $name, \Zend\Stdlib\Hydrator\Strategy\StrategyInterface $strategy) : \Zend\Stdlib\Hydrator\HydratorInterface
Inherited
inherited_from \Zend\Stdlib\Hydrator\StrategyEnabledInterface::addStrategy()

Parameters

$name

string

The name of the strategy to register.

$strategy

\Zend\Stdlib\Hydrator\Strategy\StrategyInterface

The strategy to register.

Returns

\Zend\Stdlib\Hydrator\HydratorInterface

Extract values from the provided object

extract(object $object) : array

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

Parameters

$object

object

Exceptions

\Zend\Stdlib\Exception\BadMethodCallException for an $object not implementing getArrayCopy()

Returns

array

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

extractName(string $name, null $object = null) : mixed
Inherited

Parameters

$name

string

The name to convert.

$object

null

The object is optionally provided as context.

Returns

mixed

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

extractValue(string $name, mixed $value, mixed $object = null) : mixed
Inherited

Parameters

$name

string

The name of the strategy to use.

$value

mixed

The value that should be converted.

$object

mixed

The object is optionally provided as context.

Returns

mixed

Get the filter instance

getFilter() : \Zend\Stdlib\Hydrator\Filter\FilterComposite
Inherited

Returns

\Zend\Stdlib\Hydrator\Filter\FilterComposite

Gets the naming strategy.

getNamingStrategy() : \Zend\Stdlib\Hydrator\NamingStrategy\NamingStrategyInterface
Inherited
inherited_from \Zend\Stdlib\Hydrator\NamingStrategyEnabledInterface::getNamingStrategy()

Returns

\Zend\Stdlib\Hydrator\NamingStrategy\NamingStrategyInterface

Gets the strategy with the given name.

getStrategy(string $name) : \Zend\Stdlib\Hydrator\Strategy\StrategyInterface
Inherited
inherited_from \Zend\Stdlib\Hydrator\StrategyEnabledInterface::getStrategy()

Parameters

$name

string

The name of the strategy to get.

Exceptions

\Zend\Stdlib\Exception\InvalidArgumentException

Returns

\Zend\Stdlib\Hydrator\Strategy\StrategyInterface

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

hasFilter(string $name) : boolean
Inherited
inherited_from \Zend\Stdlib\Hydrator\FilterEnabledInterface::hasFilter()

Parameters

$name

string

Index in the composite

Returns

boolean

Checks if a naming strategy exists.

hasNamingStrategy() : boolean
Inherited
inherited_from \Zend\Stdlib\Hydrator\NamingStrategyEnabledInterface::hasNamingStrategy()

Returns

boolean

Checks if the strategy with the given name exists.

hasStrategy(string $name) : boolean
Inherited
inherited_from \Zend\Stdlib\Hydrator\StrategyEnabledInterface::hasStrategy()

Parameters

$name

string

The name of the strategy to check for.

Returns

boolean

Hydrate an object

hydrate(array $data, object $object) : object

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

Parameters

$data

array

$object

object

Exceptions

\Zend\Stdlib\Exception\BadMethodCallException for an $object not implementing exchangeArray() or populate()

Returns

object

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

hydrateName(string $name, array $data = null) : mixed
Inherited

Parameters

$name

string

The name to convert.

$data

array

The whole data is optionally provided as context.

Returns

mixed

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

hydrateValue(string $name, mixed $value, array $data = null) : mixed
Inherited

Parameters

$name

string

The name of the strategy to use.

$value

mixed

The value that should be converted.

$data

array

The whole data is optionally provided as context.

Returns

mixed

Remove a filter from the composition.

removeFilter($name) : \Zend\Stdlib\Hydrator\Filter\FilterComposite
Inherited

To not extract "has" methods, you simply need to unregister it

$filterComposite->removeFilter('has');

inherited_from \Zend\Stdlib\Hydrator\FilterEnabledInterface::removeFilter()

Parameters

$name

Returns

\Zend\Stdlib\Hydrator\Filter\FilterComposite

Removes the naming strategy

removeNamingStrategy() : \Zend\Stdlib\Hydrator\ArraySerializable
Inherited
inherited_from \Zend\Stdlib\Hydrator\NamingStrategyEnabledInterface::removeNamingStrategy()
fluent This method is part of a fluent interface and will return the same instance

Returns

\Zend\Stdlib\Hydrator\ArraySerializable

Removes the strategy with the given name.

removeStrategy(string $name) : \Zend\Stdlib\Hydrator\HydratorInterface
Inherited
inherited_from \Zend\Stdlib\Hydrator\StrategyEnabledInterface::removeStrategy()

Parameters

$name

string

The name of the strategy to remove.

Returns

\Zend\Stdlib\Hydrator\HydratorInterface

Adds the given naming strategy

setNamingStrategy(\Zend\Stdlib\Hydrator\NamingStrategy\NamingStrategyInterface $strategy) : \Zend\Stdlib\Hydrator\ArraySerializable
Inherited
inherited_from \Zend\Stdlib\Hydrator\NamingStrategyEnabledInterface::setNamingStrategy()
fluent This method is part of a fluent interface and will return the same instance

Parameters

$strategy

\Zend\Stdlib\Hydrator\NamingStrategy\NamingStrategyInterface

The naming to register.

Returns

\Zend\Stdlib\Hydrator\ArraySerializable

 Properties

 

Composite to filter the methods, that need to be hydrated

$filterComposite : \Zend\Stdlib\Hydrator\Filter\FilterComposite

Default

 

An instance of NamingStrategyInterface

$namingStrategy : \Zend\Stdlib\Hydrator\NamingStrategy\NamingStrategyInterface

Default

 

The list with strategies that this hydrator has.

$strategies : \ArrayObject

Default