Skip to content

Form JMS Serializer Integration

beberlei edited this page Jul 30, 2012 · 3 revisions

Integration of JMSSerializerBundle with Form Types

Problem

Serialization of object graphs using a combination of FormType + Form using Serializer Component is much to slow. Creating the Form from the factory actually takes 1900% of the time that JMS requires to serialize the same graph.

This numbers are impossible to catch up to.

For deserialization, the current approach of SimpleThingsFormSerializerBundle is awesome though to update existing object graphs.

Idea

Using Form Types as input source to JMS Serializer metadata.

Pro:

  • JMS Metadata can be cached, Form building can't.
  • Only one metadata description necessary, the Form Type (No JMS Annotations, XML, YAML)
  • FormTypes can be used for serialization and deserialization (both with JMS and Form).

Problems with the approach:

  • JMS Serializer only supports a subset of of Form only (Property Paths, Normalization for example)
  • No known way to match this information up
  • JMS Serializer has a limitation when you have several aggregate roots that need serialization with connections. You have to add "group" for everyone of them so you don't accidently serialize the whole object graph.
  • JMS Serializer requires @PreSerialize and @PostSerialize hooks to manage bi-directional associations, whereas Form uses property paths to access methods, even on collections correctly.

Solution:

  • Make JMS Serializer use FormTypes Normalization?
  • Teach JMS Serializer property paths?

See GH-28 for a WIP pull request.