You can register any service as a handler by adding either the jms_serializer.handler
, or the jms_serializer.subscribing_handler
.
You can use the tags jms_serializer.event_listener
, or jms_serializer.event_subscriber
in order to register a listener.
The semantics are mainly the same as registering a regular Symfony2 event listener except that you can specify some additional attributes:
- format: The format that you want to listen to; defaults to all formats.
- class: The type name that you want to listen to; defaults to all types.
- direction: The direction (serialization, or deserialization); defaults to both.
Sometimes you want to serialize objects which are shipped by a third-party bundle. Such a third-party bundle might not ship with metadata that suits your needs, or possibly none, at all. In such a case, you can override the default location that is searched for metadata with a path that is under your control.
A Constructor class is used to construct new objects during deserialization. The default constructor uses the unserialize function to construct objects. Other constructors are configured as services. You can set the constructor by changing the service alias:
Below you find a reference of all configuration options with their default values: