On 2 March 2014 04:09, Roy Epperson <[email protected]> wrote: > > > How do I implement this using Doctrine 2 ORM? The options that come to me > are: > > 1. Implement an abstract class and and persists its contents in it own > table. And then subclass for each application specific user attribute > classes in there own tables. Haven't tried this one yet. > > Clean, but very, VERY inefficient. This will cause an explosion of joins, tables, indexes and hydration complexity.
> > 1. Define an interface to help enforce objects added to the > $this->user_attributes. I tried this but schema creation did could not > fine the interface definition so I could not continue to try > > This is actually the same as the first option. > > 1. Have begun looking at Keeping your module > independent<http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/resolve-target-entity-listener.html>s > but haven't figured it out enough to see if it would apply > > That is an idea that allows overrideable associations/entities, not really for a map of properties I suggest you to look at http://doctrine-orm.readthedocs.org/en/latest/cookbook/strategy-cookbook-introduction.htmlinstead. There will be some manual hydration as you keep references through objects via identifiers, and not direct object references, but it is much cleaner and would allow you to use generic attributes in a form like: [ ["object-id", "AttributeTypeA", "attribute-a-id"], ["object-id", "AttributeTypeA", "attribute-a-id-2"], ["object-id-2", "AttributeTypeA", "attribute-a-id"], ["object-id", "AttributeTypeB", "attribute-B-id"], // ... ] Cheers, Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/groups/opt_out.
