DDC-2826: Add support for mapping collections of embeddable objects #3579

Open
doctrinebot opened this Issue Nov 28, 2013 · 1 comment

2 participants

@doctrinebot

Jira issue originally created by user songoko20000:

In Hibernate we can do something like this:

    @Entity
    public class User {
       [...]
       public String getLastname() { ...}

       @ElementCollection
       @CollectionTable(name="Addresses", joinColumns=@JoinColumn(name="user_id"))
       @AttributeOverrides({
          @AttributeOverride(name="street1", column=@Column(name="fld_street"))
       })
       public Set<Address> getAddresses() { ... } 
    }

    @Embeddable
    public class Address {
       public String getStreet1() {...}
       [...]
    }

Basically a collection of value objects is mapped to a new table. Currently Doctrine2 is on its way to support value objects

However, this implementation won't support mapping a collection of objects to a new table and the only way to circumvent this issue is to treat the address an an entity and use an one-to-many unidirectional relationship through a many-to-many join table

@doctrinebot

Comment created by @doctrinebot:

A related Github Pull-Request [GH-835] was closed:
#835

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment