Serialize and deserialize single entity object work properly for me.
It is possible to serialize and deserialize multiple object (array of objects) in this way??
$notifications = $this->getDoctrine()
->getRepository('AppBundle:Notification')
->findAll();
$encoder = new JsonEncoder();
$normalizer = new ObjectNormalizer();
$serializer = new Serializer(array($normalizer), array($encoder));
$jsonContent = $serializer->serialize($notifications, 'json');
return new Response($jsonContent);
And
$response = curl_exec($ch); // my $jsonContent from previous code
$encoder = new JsonEncoder();
$normalizer = new ObjectNormalizer();
$serializer = new Serializer(array($normalizer), array($encoder));
$notifications = $serializer->deserialize($response, Notification::class, 'json');
Then i got:
The property path constructor needs a string or an instance of "Symfony\Component\PropertyAccess\PropertyPath". Got: "integer" 500 Internal Server Error - UnexpectedValueException
PropertyPath, which is a child of PropertyAccess. But, your constructor get an Integer as parameter, which is obviously wrong. Can you add your construtor and everything related to it in your question plz?