symfony/symfony — pull request #4904 by stof (2012-07-14 09:09:52+00:00)
Title: [Serializer] Added a ChainEncoder and a ChainDecoder

These classes contains the logic previously defined in the Serializer itself to handle the choice of a serializer. This allows reusing it when using only the encoding part of the component, without having to use the Serializer class (which is not as handy to bootstrap when you want to use only encoders and decoders as normalizers come first)

I was wondering if these classes should have adders but I kept the constructor injection only to be consistent with the current code (encoders cannot be registered after the instantiation) and to avoid implementing the SerializerAwareInterface in them (to allow injecting the Serializer in serializer-aware encoders and decoders added later).

Note that this change is fully BC as it only changes the internal implementation of the Serializer.