FAQ Database Discussion Community


JMS Deserialize ArrayCollection in Object

php,serialization,doctrine2,jms-serializer
I'm trying to use JMS serializer in my application (not Symfony) and would like to deserialize a JSON object to the Doctrine Entity. The plain properties are getting properly deserialized, but I can't get the ArrayCollections to work. This is an excerpt of my product JSON: { "id": 2, "name":...

Add a root element name using JMS Serializer with Symfony 2.6

symfony2,fosrestbundle,jmsserializerbundle,jms-serializer,symfony-2.6
I have implemented web services using Symfony 2.6 with FOSRestBundle and JMSSerializerBundle. I can't manage to have a root element named request eventhough I put xml_root_name: request in the configuration file. I have a config\serializer\Entity.Request.yml file with the following information: Tvjp\RequestBundle\Entity\Request: exclusion_policy: ALL xml_root_name: request properties: id: expose: true type:...

Can't serialize virtual properties in schmittjoh/serializer

php,jmsserializerbundle,jms-serializer
One of my classes that I'm serializing has a virtual property that I would like to see. I'm using yaml configuration. Here's the yaml: Namespace\Model\Keg: exclusion_policy: ALL properties: A list of properties that work virtual_properties: getKegImage: serialized_name: image Here's the class: namespace Namespace\Model; class Keg extends ModelAbstract { /** Some...

Jms serializer @JMS\Inline() annotation overrides an actual id

php,symfony2,doctrine2,jmsserializerbundle,jms-serializer
I have product and product_detail tables in database. Every product has a product detail. class Product { /** * @var ProductDetail * @JMS\ReadOnly() * @ORM\OneToOne(targetEntity="ApiBundle\Entity\ProductDetail", mappedBy="product", cascade={"persist"}) * @JMS\Inline() */ private $detail; } I use @JMS\Inline() annotation to show only detail information of product_detail table. But when I serialize a...

Symfony2 Doctrine2 De-Serialize and Merge Entity issue

json,symfony2,doctrine2,jms-serializer
I am trying to de-serialize json into an Entity and then Merge the Entity. I believe I had this working in the past where I would send the ID and any fields I wished to update. For example: In my DB: | id | first | last | city | |...