Skip to content

[Form][Collection] Collection type is broken #1540

Closed
@stof

Description

@stof

The collection type is broken when using it for the inversed side of a Doctrine relation as it modifies the collection instead of calling some setter in the class. As Doctrine does not track changes in the inversed side, the changes are not persisted.

The best practice for Doctrine is to call the setter of the owning side in the setter of the inversed side. But as the setter is not called, this has no effect for the forms. And there is currently no way to change this behavior in user-land forms.

I suggested in #1141 to allow defining the setter used. A collection type should then call addXXX and removeXXX on the object instead of modifying the collection to allow having additionnal logic when adding and removing elements.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions