Category : jmsserializerbundle

Symfony 5.2 with jms/serializer-bundle 3.7.0. After syfmony cache cleaning by command cache:clear on the next request I get an error: The directory "var/cache/dev/jms_serializer" does not exist I noticed that for symfony 4.4 $dir variable has var/cache/de_/jms_serializer value, but for symfony 5.2 has var/cache/dev/jms_serializer So when symfony 5.2 runs warn up, JMSSerializerBundle creates jms_serializer folder in ..

Read more

I have an entity with some OneToOne relations: /** * @OAProperty(type="integer") * @SerializerGroups({"list", "detail"}) * @SerializerType("File::class") * @ORMOneToOne(targetEntity="File") */ private ?File $cv = null; And here is the File entity: /** * @OASchema() * @ORMEntity(repositoryClass=FileRepository::class) */ class File { /** * @OAProperty(type="integer") * @SerializerGroups({"list", "detail"}) * @SerializerType("integer") * @ORMId * @ORMGeneratedValue * @ORMColumn(type="integer") */ private ..

Read more

I’m using symfony 4 alongside FOSRestBundle and JMSSerializer. What I’m encountering is when object data transformed into json by JMSSerializer during preparing view object into response, backslash is being added before newline characters(n) stored in object string fields. So part of my response data looking like this: "hint": "10% с объема заказов комьюнити на 1 ..

Read more

I want intercept all errors of Symfony after that show them in JSON. In friendsofsymfony/rest-bundle v2 I can set parameters fos_rest: exception: enabled: true exception_controller: ‘AppControllerExceptionController::showAction’ … But in V3 the parameter exception_controller is deleted. My current config of FOS REST: fos_rest: view: formats: xml: false json: true view_response_listener: force serializer: groups: [‘Default’] serialize_null: true ..

Read more

I send a get http request from angular side to symfony to get command details, I have many nested json objects and Circular Reference, I’m trying to set MaxDepth to the related entity and as the documentation of jms said add this line $serializer->serialize($command, ‘json’, SerializationContext::create()->enableMaxDepthChecks()); to create a serializer context and enable the maxDepth ..

Read more