schmittjoh/serializer — pull request #28 by adrienbrault (2013-01-24 21:12:39+00:00)
Title: The NavigatorContext now holds a metadata stack

Hey,

This will let EventSubscribers that uses `GenericSerializationVisitor::addData` be able to handle cases when a property is inlined, and defer the addition of data to the "top level inline container".

For example, in FSCHateoasBundle, there is a `serializer.post_serialize` event subscriber that does `->addData('links', array(...))`.
Now, if an object is inlined into another, and both have links, the event subscriber will first add links from the embedded object, and then try to add the links from the container object (this one will fail).
Now, with this PR, the link event subscriber will be able to detect if the n-1 metadata is a PropertyMetadata and $propertyMetadata->inline is true; and would then defer the additions of links.

Maybe we could add some `getClassMetadata` or `getContainerPropertyMetadata` accessors to the NavigatorContext that would make the necessary checks (if the stack->count() is 0, even etc).