package Default

 Methods

You can describe how your values will extract and hydrate, like this: $hydrator->addStrategy('category', new ClosureStrategy( function (Category $value) { return (int) $value->id; }, function ($value) { return new Category((int) $value); } ));

__construct(callable $extractFunc = null, callable $hydrateFunc = null

Parameters

$extractFunc

callable
  • anonymous function, that extract values from object

$hydrateFunc

callable
  • anonymous function, that hydrate values into object

Converts the given value so that it can be extracted by the hydrator.

extract(mixed $value, array $object = null) : mixed
inherited_from \Zend\Stdlib\Hydrator\Strategy\StrategyInterface::extract()

Parameters

$value

mixed

The original value.

$object

array

The object is optionally provided as context.

Returns

mixedReturns the value that should be extracted.

Converts the given value so that it can be hydrated by the hydrator.

hydrate(mixed $value, array $data = null) : mixed
inherited_from \Zend\Stdlib\Hydrator\Strategy\StrategyInterface::hydrate()

Parameters

$value

mixed

The original value.

$data

array

The whole data is optionally provided as context.

Returns

mixedReturns the value that should be hydrated.

 Properties

 

Function, used in extract method, default: function ($value) { return $value; };

$extractFunc : callable

Default

null
 

Function, used in hydrate method, default: function ($value) { return $value; };

$hydrateFunc : callable

Default

null