How to manage deserialized entities with entity manager?

后端 未结 2 1257
感情败类
感情败类 2020-12-16 08:38

I am using JMSSerializerBundle to serialize my entities to json and deserialize json into entities, but I think this question applies for any deserialization techniques.

2条回答
  •  無奈伤痛
    2020-12-16 09:38

    I know this question is three years old, but it mislead me to think the only answer was using the merge operation. I'd like to add my two cents:

    The JMSSerializerBundle includes an object constructor for Doctrine entities. When you enable this constructor, the deserialized entities are managed entities that can be persisted(with $em->persist($entity)).

    Please check this comment to understand other benefits from this. And here is how you can enable it.

提交回复
热议问题