Methods

Define if extract values will use camel case or name with underscore

__construct(bool | array $underscoreSeparatedKeys) 

Parameters

$underscoreSeparatedKeys

boolarray

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

addFilter(string $name, \Zend\Stdlib\Hydrator\callable | \Zend\Stdlib\Hydrator\Filter\FilterInterface $filter, int $condition) : \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\AbstractHydrator::addFilter()

Parameters

$name

string

Index in the composite

$filter

\Zend\Stdlib\Hydrator\callable\Zend\Stdlib\Hydrator\Filter\FilterInterface

$condition

int

Returns

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\AbstractHydrator::addStrategy()

Parameters

$name

string

The name of the strategy to register.

$strategy

\Zend\Stdlib\Hydrator\Strategy\StrategyInterface

The strategy to register.

Returns

Extract values from an object with class methods

extract(object $object) : array

Extracts the getter/setter of the given $object.

Parameters

$object

object

Exceptions

\Zend\Stdlib\Exception\BadMethodCallException for a non-object $object

Returns

array

Convert a name for extraction.

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

If no naming strategy exists, the plain value is returned.

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::extractName()

Parameters

$name

string

The name to convert.

$object

null

The object is optionally provided as context.

Returns

mixed

Converts a value for extraction.

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

If no strategy exists the plain value is returned.

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::extractValue()

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

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::getFilter()

Returns

Gets the naming strategy.

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

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::getNamingStrategy()

Returns

Gets the strategy with the given name.

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

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::getStrategy()

Parameters

$name

string

The name of the strategy to get.

Exceptions

\Zend\Stdlib\Exception\InvalidArgumentException

Returns

getUnderscoreSeparatedKeys()

getUnderscoreSeparatedKeys() : bool

Returns

bool

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

hasFilter(string $name) : bool
Inherited

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::hasFilter()

Parameters

$name

string

Index in the composite

Returns

bool

Checks if a naming strategy exists.

hasNamingStrategy() : bool
Inherited

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::hasNamingStrategy()

Returns

bool

Checks if the strategy with the given name exists.

hasStrategy(string $name) : bool
Inherited

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::hasStrategy()

Parameters

$name

string

The name of the strategy to check for.

Returns

bool

Hydrate an object by populating getter/setter methods

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

Hydrates an object by getter/setter methods of the object.

Parameters

$data

array

$object

object

Exceptions

\Zend\Stdlib\Exception\BadMethodCallException for a non-object $object

Returns

object

Converts a value for hydration.

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

If no naming strategy exists, the plain value is returned.

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::hydrateName()

Parameters

$name

string

The name to convert.

$data

array

The whole data is optionally provided as context.

Returns

mixed

Converts a value for hydration.

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

If no strategy exists the plain value is returned.

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::hydrateValue()

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\AbstractHydrator::removeFilter()

Parameters

$name

Returns

Removes the naming strategy

removeNamingStrategy() : \Zend\Stdlib\Hydrator\self
Inherited

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::removeNamingStrategy()

Returns

\Zend\Stdlib\Hydrator\self

Removes the strategy with the given name.

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

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::removeStrategy()

Parameters

$name

string

The name of the strategy to remove.

Returns

Adds the given naming strategy

setNamingStrategy(\Zend\Stdlib\Hydrator\NamingStrategy\NamingStrategyInterface $strategy) : \Zend\Stdlib\Hydrator\self
Inherited

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::setNamingStrategy()

Parameters

Returns

\Zend\Stdlib\Hydrator\self

setOptions()

setOptions(array | \Traversable $options) : \Zend\Stdlib\Hydrator\ClassMethods

Parameters

$options

array\Traversable

Exceptions

\Zend\Stdlib\Exception\InvalidArgumentException

Returns

setUnderscoreSeparatedKeys()

setUnderscoreSeparatedKeys(bool $underscoreSeparatedKeys) : \Zend\Stdlib\Hydrator\ClassMethods

Parameters

$underscoreSeparatedKeys

bool

Returns

 Properties

 

Composite to filter the methods, that need to be hydrated

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

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::$$filterComposite
 

An instance of NamingStrategyInterface

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

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::$$namingStrategy
 

The list with strategies that this hydrator has.

$strategies : \ArrayObject
Inherited

inherited_from \Zend\Stdlib\Hydrator\AbstractHydrator::$$strategies
 

Flag defining whether array keys are underscore-separated (true) or camel case (false)

$underscoreSeparatedKeys : bool

 

$callableMethodFilter

$callableMethodFilter : \Zend\Stdlib\Hydrator\Filter\FilterInterface