schmittjoh/serializer — pull request #24 by colinmorelli (2013-01-20 15:48:53+00:00)
Title: Adding serializer.pre_deserialize event

This event will allow the dev to modify the data that is going to be deserialized by using the PreDeserializeEvent class.

My use case was in a REST API, where the user includes the ID of the entity to update in the URL, but not in the object itself (don't want it to be in two places - it seems redundant).

In this case, the DoctrineObjectConstructor can't load the object from the DB (because the ID is not in the data).

I'm using this event listener to capture the pre-deserialize, set the ID field before the Doctrine object constructor runs, and now all appears to work great.