1850. Class

1850.1. Zend\Stdlib\Hydrator\Strategy\ClosureStrategy

1850.1.1. Methods

1850.1.1.1. __construct

__construct()

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

}

));

Parameters:callable
  • anonymous function, that extract values
from object
param callable:
  • anonymous function, that hydrate values

into object

1850.1.1.2. extract

extract()

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

Parameters:mixed – The original value.
Return type:mixed Returns the value that should be extracted.

1850.1.1.3. hydrate

hydrate()

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

Parameters:mixed – The original value.
Return type:mixed Returns the value that should be hydrated.

Project Versions

Table Of Contents

Previous topic

1849. Function

Next topic

1851. Class

This Page