Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-2089

Modify OneToMany to allow unidirectional associations without the need of a JoinTable

    Details

    • Type: Improvement
    • Status: Awaiting Feedback
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.x
    • Fix Version/s: 3.0
    • Component/s: ORM
    • Security Level: All
    • Environment:
      Debian Wheezy, Mysql 5.1, Apache2, PHP 5.4

      Description

      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?

        Activity

        noise085 Enea Bette created issue -
        noise085 Enea Bette made changes -
        Field Original Value New Value
        Attachment otm without jointable.png [ 11337 ]
        Show
        noise085 Enea Bette added a comment - A little up... for inspiration from JPA http://en.wikibooks.org/wiki/Java_Persistence/OneToMany#Undirectional_OneToMany.2C_No_Inverse_ManyToOne.2C_No_Join_Table_.28JPA_2.0_ONLY.29
        beberlei Benjamin Eberlei made changes -
        Fix Version/s 2.5 [ 10522 ]
        Fix Version/s 2.4 [ 10321 ]
        Hide
        danielpitts Daniel Pitts added a comment -

        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.

        Show
        danielpitts Daniel Pitts added a comment - 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.
        ocramius Marco Pivetta made changes -
        Fix Version/s 2.5 [ 10522 ]
        Hide
        Fruchuxs Florian Vogelpohl added a comment - - edited

        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 ...

        Show
        Fruchuxs Florian Vogelpohl added a comment - - edited 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 ...
        Fruchuxs Florian Vogelpohl made changes -
        Status Open [ 1 ] Awaiting Feedback [ 10000 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={expand=changesets[0:20].revisions[0:29],reviews, query=DDC-2089}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            beberlei Benjamin Eberlei
            Reporter:
            noise085 Enea Bette
          • Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated: