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 –
|
---|
param callable: |
|
---|
into object
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. |
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. |