Questions tagged [jms-serializer]

Serializer is a library, that allows you to (de-)serialize data of any complexity. It supports XML, JSON, and YAML.

Serializer is a library, that allows you to (de-)serialize data of any complexity. Currently, it supports XML, JSON, and YAML.

Website: http://jmsyst.com/libs/serializer

It also provides you with a rich tool-set to adapt the output to your specific needs.

Built-in features include:

  • (De-)serialize data of any complexity; circular references are handled gracefully.
  • Supports many built-in PHP types (such as dates)
  • Integrates with Doctrine ORM, et. al.
  • Supports versioning, e.g. for APIs
  • Configurable via PHP, XML, YAML, or Doctrine Annotations
222 questions
1
vote
4 answers

Symfony2 - unable to autoload JMS serializer annotations

We are having issues autoloading JMSSerializer annotations in a symfony app. We are getting: [Semantical Error] The annotation "@JMS\Serializer\Annotation\XMLRoot" in class Class\Namespace\ClassName does not exist, or could not be auto-loaded. We…
roinir
  • 300
  • 2
  • 9
1
vote
1 answer

JMSSerializer and inheritance Class

I have got a problem with JMS Serializer and inheritance class. When I serialize my entities it doesn't take care of JMSSerializer Annotation because of inheritance class... So How could I set JMSSerializer Annocation with class inheritance…
1
vote
1 answer

Doctrine Entity won't serialize with JMS Serializer

I have one entity that won't serialize with JMS Serializer. It throws no errors just a blank screen. If I expose this entity in any of it's related entities it responds with a blank page. I've been poking at this for over a day and it's become…
1
vote
2 answers

JMS Serializer serialize object in object with diffrent view

I'm developing a RESTful service with Symfony2, JMS Serializer Bundle, FOS Rest Bundle and Hateoas Bundle. There are 2 entities User and Company and I want to, when I serialize a Company get larger detail. But, when serializing User related Company…
1
vote
0 answers

Why does not jms serializer show entities in deeper levels?

I have entity Company with many Users and User has many Tokens. I would like to serialize Token with User inside. // @JMS\MaxDepth(depth=0) Token::$user; If I do this, the serialized result will be:…
Keo
  • 1,143
  • 8
  • 19
1
vote
1 answer

JMS Serializer, Doctrine, Persist deserialized OneToMany

I'm trying to save a deserialized OneToMany connection, but doctrine leaves the id-field of the parent item ($parent) empty. class MyParent { /** * @ORM\OneToMany(targetEntity="MyChild", mappedBy="parent", cascade={"persist"}) * *…
1
vote
1 answer

Add a root element name using JMS Serializer with 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…
1
vote
1 answer

Force JMS Serialiser to output an object keyed by a specific field

I have an entity Product with a one-to-many relationship to an entity Property. When I serialise a product instance using the JMS Serialiser I get the following JSON output: { "id": 123, "name": "Mankini Thong", "properties": [{ …
Sander Toonen
  • 3,463
  • 35
  • 54
1
vote
1 answer

How to change method to call for an entity on the PreSerializeEvent?

I have a Category entity that contains a bunch of Assets. The Category has a getCount method that return the amount of assets in it. I use FosRestBundle and hence JMSSerializerBundle to serialize the Category asset to json. Now, there was a feature…
k0pernikus
  • 60,309
  • 67
  • 216
  • 347
1
vote
1 answer

Is there a way to initialize a JSM Serializer manually?

I'm writing a PHP wrapper project for an API. Within my response object, I like to deserialize a JSON block to an object. It is not a symfony standard framework project, just a PHP project with symfony components. Within a symfony project I would…
Christian Kolb
  • 1,368
  • 2
  • 23
  • 43
1
vote
0 answers

Serving form type choices in a RESTful controller

Imagine the following simple form type in a restul symfony2 application:
nietonfir
  • 4,797
  • 6
  • 31
  • 43
1
vote
1 answer

How to serialize an entity in Symfony2 with dependent objects

I have a Product entity, and a ProductList entity. Is it possible to serialize (and deserialize) a ProductList object to json in a way that the json contains the Product objects related to that ProductList? The expected output is: [{ …
0
votes
1 answer

JMS Service not pushing XML files to Queue. Stops processing in between and needed to restart the service to push the files further

There is a directory named /var/xyz/aa/clm/data/infiles/SenderJMS/CE/L3/ where number of XML files are stored after a process runs. These files contain data to be pushed to remote server through a JMS queue. The queue is configured at client's cloud…
0
votes
1 answer

Equivalance symfony/serializer "SerializedPath" for jms/serializer

I have this particular json to decode with jms/serializer: { "id": 42, "attributes": { "name": "toto", "alternativeText": null } } into: class Image { public string $name; } With symfony/serializer a can use the attribute…
SuperBob
  • 76
  • 3
0
votes
0 answers

JMS Serialzer update to 3.x replacement for serializer->getMetadataFactory()

I have some legacy code here using serializer 1.x that needs to be updated to PHP8 - so to serialzer 3.x. The problem is the old code uses> serializer->getMetadataFactory() to dynamically override subitem tyes like this: /** @var…
Tobias Gaertner
  • 1,155
  • 12
  • 30