mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Problem with collection inside other collection. #5195
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jbragui on GitHub (Jul 19, 2016).
Hello. I am new in Symfony and I am working with this example: I have an Entity Called TypeOfAdmission which has an attribute called plans which is an array. Because of this, the relation between the entities TypeOfAdmission and Plan is from OneToMany. In the entity called Plan I have other attribute called subjects which is an array. Because of this, the relation between the entities Plan and Subject is from OneToMany...
It's like this: TypeOfAdmission -> Plan -> Subject ...
The problem is that when I am registering an instance of TypeOfAdmission I request to register Plans and the plans request subjects, everything goes well, but when saving it, the array of plans are saved well, but the array of subjects from every plan just get the last item registered.
I register this:
Admission Type 1
Plan 1
Subject 1
Subject 2
Plan 2
Subject 3
Subject 4
But on my database it is saved like this:
Admission Type 1
Plan 1
Subject 2
Plan 2
Subject 4
Anybody has had the same trouble?
Hope you can help me.
Thx in advance.
@Ocramius commented on GitHub (Jul 19, 2016):
Can you make an actual code example? Meanwhile, check https://gist.github.com/Ocramius/3121916, as it should clarify that you are responsible for setting all sides of the associations.