[DDC-2089] Modify OneToMany to allow unidirectional associations without the need of a JoinTable Created: 19/Oct/12  Updated: 05/Jun/15

Status: Awaiting Feedback
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.x
Fix Version/s: 3.0
Security Level: All

Type: Improvement Priority: Major
Reporter: Enea Bette Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 2
Labels: onetomany, persister, unidirectional

Debian Wheezy, Mysql 5.1, Apache2, PHP 5.4


As I sayd in the title, it would be nice if the ORM layer could permit to map a 1:n association in the db as an unidirectional OneToMany in the classes, without using a JoinTable in the database.
This would permit us to get rid of the unnecessary database JoinTable, which creates disorder and decreases performance for no valuable reason.

Is it possible?

Comment by Enea Bette [ 16/Dec/12 ]

A little up... for inspiration from JPA


Comment by Daniel Pitts [ 07/Oct/14 ]

This is also a big issue for Symfony2 forms. It's very difficult to make a form type for a collection of "things", where the "things" are fully owned by the parent object.

Comment by Florian Vogelpohl [ 05/Jun/15 ]

There are any plans to implement this feature?
The unidirection OneToMany with JoinTable is a little bit tricky, because in some cases you can't remove entities from parent. Also its not a real "Object-relation-mapping" because you need to add a (unnecessary) inverse field. This brakes the object domain model.

E.g.: If you have an entity Account which holds a collectionof Members (unidirectional) and now you want to remove a Member from the collection you get an "Cannot delete or update a parent row: a foreign key constraint fails " error ...

Generated at Sun Oct 04 11:29:42 EDT 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.