Category: serializer

How can I remove doctrine proxies field in symfony 5 json?

My code: public function findAll(): JsonResponse { $products = $this->productRepository->findAll(); return $this->json(( new ApiJsonResponse(ApiJsonResponse::TYPE_SUCCESS, $products) )); } return: “productType”: { “id”: 1, “name”: “product type 1”, “active”: true, “initializer”: null, “cloner”: null, “isInitialized”: true } I’m using sumfony 5 and…

Notice: Accessing static property PhpArrayAdapter::$valuesCache as non static, when try to get a collection of data using api platform

I’m using symfony and api pplatform, and I have a problem getting a collection of data using GET operation on user entity with Api Platform. First it was working on a branch with other operations, after I did the merge…

Deserialize complex XML to object

I have a complex XML file which i need to deserialize to an PHP Object. XML <?xml version=”1.0″ encoding=”UTF-8″?> <xb:BAG-Extract-Deelbestand-LVC xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” …> <xb:antwoord> <xb:vraag> <selecties-extract:Gebied-Registratief> <selecties-extract:Gebied-NLD> <selecties-extract:GebiedIdentificatie>9999</selecties-extract:GebiedIdentificatie> <selecties-extract:GebiedNaam>Nederland</selecties-extract:GebiedNaam> <selecties-extract:gebiedTypeNederland>1</selecties-extract:gebiedTypeNederland> </selecties-extract:Gebied-NLD> </selecties-extract:Gebied-Registratief> <selecties-extract:StandTechnischeDatum>20200208</selecties-extract:StandTechnischeDatum> </xb:vraag> <xb:producten> <product_LVC:LVC-product> <bag_LVC:Nummeraanduiding> <bag_LVC:identificatie>123456789</bag_LVC:identificatie> <bag_LVC:aanduidingRecordInactief>N</bag_LVC:aanduidingRecordInactief> <bag_LVC:aanduidingRecordCorrectie>0</bag_LVC:aanduidingRecordCorrectie> </bag_LVC:Nummeraanduiding>…

Symfony serializer cannot deserialize into DateTime

I‘m trying to deserialize a json with the Symfony Serializer into a DTO, but I got always the exception Symfony/Component/Serializer/Exception/MissingConstructorArgumentsException with message ‘Cannot create an instance of DateTime from serialized data because its constructor requires parameter “time” to be present.’….