Filters & hydrators #5099

Closed
flip111 opened this Issue Sep 10, 2013 · 4 comments

3 participants

@flip111

I was trying to make a hydrator and using filters. I made a small code to use a hydrator with annotations. And i came to the following problems:

1.
->filter() does not have a generic interface. Sometimes only the propertyName is passed sometimes the \nameSpace\Class::Property
the FQCN is useful because then you can get the reflection information. But some combinations of hydrators and filters are not compatible.

2.
(This is more a problem about the hydrators)
There are only filters used for extracting and not hydrating. Of course you can filter the array yourself before you hydrate but then it's not good for re-use of code and seperation of concerns.

@flip111

Here is an example where filter takes class::property
https://github.com/zendframework/zf2/blob/master/library/Zend/Stdlib/Hydrator/ClassMethods.php#L138

Here is an example where filter takes propertyName
https://github.com/zendframework/zf2/blob/master/library/Zend/Stdlib/Hydrator/Reflection.php#L34

There is no example of the filter taking the property value (but it could, because the interface/standard doesn't specify that).

I need a filter that can take the value as well as a ReflectionProperty (or get a class + property to build the reflection property from there)

@Ocramius
Zend Framework member

What about passing the hydrated/extraction object to the filter?

So basically modify filters to handle filter($propertyName, $object, $context)?

Just a wild guess on how this could be enhanced.

@flip111

That would be perfect, it won't be compatible with the current interface though. Maybe it will work, but the interface doesn't specify this.

@GeeH GeeH added the To Be Closed label Mar 5, 2016
@GeeH

This issue has been closed as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html

@GeeH GeeH closed this Jun 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment