You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\MaxDepth;
/**
* @ORM\Entity
*/
class UserOrder
{
/**
* @ORM\Id()
* @ORM\GeneratedValue(strategy="UUID")
* @ORM\Column(type="guid", unique=true)
*/
private $id;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $status;
/**
* @var OrderDetail[] | ArrayCollection
* @ORM\OneToMany(targetEntity=OrderDetail::class, mappedBy="order", orphanRemoval=true, cascade={"persist"})
*/
private $orderDetails;
....
I can get an object with this instruction in my controller :
$normalizer = new ObjectNormalizer(null, null, null, new ReflectionExtractor());
$serializer = new Serializer([new ArrayDenormalizer(), $normalizer], [new JsonEncoder()]);
$userOrder = $serializer->deserialize($request->getContent(), UserOrder::class, 'json');
But I would like to use the serializer service directly, is there any way for perform a recursive deserialization with doctrine-json-odm and get real object, not an array ? Thanks for your time
The text was updated successfully, but these errors were encountered:
Hi, I would like to perform a recursive deserialization. But the problem is that the function return an array instead of object.
services.yaml =>
$userorder is an array instead of object.
this is my entity =>
I can get an object with this instruction in my controller :
But I would like to use the serializer service directly, is there any way for perform a recursive deserialization with doctrine-json-odm and get real object, not an array ? Thanks for your time
The text was updated successfully, but these errors were encountered: