I suspect this might have already been discussed but didn't find it in any 
of the search patterns I tried. 

I would like to implement a User class which has basic attributes for aUser 
and then a collection if other modules' could add specific user 
attributes/methods class(es) which an when used in an application built 
from various modules.

class User{

private $user_attributes = new 
\Doctrine\Common\Collections\ArrayCollection();

public function addUserAttribute(UserAttributeInterace $attribute){
$this->user_attributes->add($attribute);
}

public function <which extracts a specific Class of 
user_attributes>UserAttributeInterace $attribute){
return selected attribute;
}
}

class UserAuthorizationAttributes  [implements | extends] 
UserAttributeInterface{
private $user_attributes = new 
\Doctrine\Common\Collections\ArrayCollection();

}

class UserForumAttributes  [implements | extends] UserAttributeInterface{
private $user_attributes = new 
\Doctrine\Common\Collections\ArrayCollection();

}

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

My preference would not to subclass because other namespaces would need to 
know about UserAttribute implementation not interface and I would like to 
lookup aUser and acquire all the modules' user attributes and not get user 
and then have to do a separate lookup for those attributes.

Thanks in advance,

Roy














}

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

Reply via email to