Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Filters & hydrators #5099

flip111 opened this Issue · 3 comments

2 participants

flip111 Marco Pivetta

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:

->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.

(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.


Here is an example where filter takes class::property

Here is an example where filter takes propertyName

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)

Marco Pivetta

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.


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.