Questions tagged [symfony-serializer]

11 questions
2
votes
1 answer

Symfony 6 only serializing first occurrence of a joined object in Json Response

Not sure on if the title makes sense, but will try explain with an example: Say for instance I have the following Entities: #[ORM\Entity(repositoryClass: Post::class)] class Post { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] …
1
vote
0 answers

Unable to inject serializer service in parent abstract class in symfony 4.4

I'm just trying to inject the symfony serializer into an abstract class constructor, but that does not seem to work at all : namespace App\DTO; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Serializer\Serializer; use…
naspy971
  • 1,137
  • 2
  • 13
  • 31
0
votes
1 answer

Method with a SerializedName attribute getting ignored when object is serialized with symfony serializer

I have a symfony serializer that i initialize this way : $this->serializer = new Serializer( [ new ArrayDenormalizer(), new UidNormalizer(), new BackedEnumNormalizer(), new DateTimeNormalizer(), new…
Methraen
  • 11
  • 3
0
votes
1 answer

Serialize and deserialize objects with objects as property type using SymfonySerializer

Is there a way to normalize (serialize and deserialize) object using Symfony Serializer (ObjectNormalizer) but by properties, not get/set/is... methods? There is ObjectNormalizer but it's using get/set/is... methods, not declared properties, I have…
Wiktor
  • 1
  • 1
0
votes
1 answer

Symfony serializer - Deserialize xml to array of objects

php Symfony serializer - Deserialize xml to array of objects How deserialize xml with attributes to array of objects? $string = ' '; …
Kanat
  • 3
  • 1
0
votes
0 answers

Api Platform not persist OneToMany relation

I'm working with API Platform using Doctrine Inheritance and I have a problem persisting a OneToMany relation. curl --location 'http://localhost/api/dummies' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --data…
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

ApiPlatform and Symfony Serializer: How to set serialization groups via Yaml for external objects

I have an entity User like this: use SerendipityHQ\Component\ValueObjects\Email\Email; #[Entity] #[Table(name: 'users', schema: 'my_schema')] #[API\ApiResource( openapiContext: ['tags' => [self::OPENAPI_TAG]], normalizationContext: [ …
Aerendir
  • 6,152
  • 9
  • 55
  • 108
0
votes
1 answer

Symfony Serializer - Deserialize XML with attributes

I cant figure out how to deserialize this xml with the symfony serializer
23nr1
  • 11
  • 2
0
votes
1 answer

ApiPlatform: Serialization for the format "graphql" is not supported

i want to see graphql options in swagger docs, so i added this to config/packages/api_platform.yaml: api_platform: formats: graphql: [ 'application/graphql' ] but now when i load the docs page i get this: { …
ddruganov
  • 1,263
  • 13
  • 15