schmittjoh/JMSSerializerBundle — pull request #189 by schmittjoh (2012-10-05 12:45:28+00:00)
Title: [WIP] adds an event system

TODO: Add some docs, and tests

This adds an event system to the serializer. Basically, you can now register dedicated classes where you currently could only use methods on objects, that is on pre-serialization, post-serialization, and post-deserialization.

I've not re-used an existing event dispatcher (I've looked at Symfony, and Doctrine ones) for several reasons:

- making listener registration cheap: You can have many event listeners without any significant performance impact now.
- Lazy-load only what is needed; in that regard you can register listeners for a specific class and/or format only which will never be loaded otherwise.

This should help to implement something like #121 in a cleaner, more re-usable way. I've also thought about allowing listeners to skip serialization for an object, but I'm not sure about this yet.

Feedback welcome.