Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
How to denormalize into an ArrayCollection#61059
Unanswered
alessandro-podo asked this question inQ&A
-
In the following configuration, I would expect the RelationCollection to contain elements, but it remains empty. Can the Serializer use Collection and if so, how does this work? Have I overlooked something in the documentation? $data = ['id' =>1,'relations' => [ ['id' =>100, ], ], ];$ci =$this->serializer->denormalize($data, Ci::class); useDoctrine\Common\Collections\ArrayCollection;useDoctrine\Common\Collections\Collection;/** * @template-extends Collection<int, Relation> */class RelationCollectionextends ArrayCollection{} finalreadonlyclass Ci{publicfunction__construct(publicint$id,/** * @var RelationCollection<Relation> */public ?RelationCollection$relations =null, ) {}} finalreadonlyclass Relation {publicfunction__construct(publicint$id, ) { }} |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 1 comment
-
['id' =>1,'relations' => ['elements' => [ ['id' =>100], ], ],] Note that |
BetaWas this translation helpful?Give feedback.
All reactions
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment