down vote | You can see in this link to know about inheritance: You must declare in UserBundle\Entity\User: /** * @Entity * @InheritanceType("SINGLE_TABLE") * @DiscriminatorColumn(name="discr", type="string") * @DiscriminatorMap({"baseuser" = "UserBundle\Entity\User", "blogUser" = "BlogBundle\Entity\User"}) */class User implements UserInterface{ ...} And BlogBundle\Entity\User use App\UserBundle\Entity\User as BaseUser;/** * @ORM\Entity */class User extends BaseUser{ ....} Goodluck! |
//
http://stackoverflow.com/questions/5823905/how-to-manage-single-table-inheritance-within-doctrine-2
--------------------------------------------------------
Based on the example from the :
/** * @Entity * @InheritanceType("SINGLE_TABLE") * @DiscriminatorColumn(name="resource_type", type="string") * @DiscriminatorMap({"article_vote" = "ArticleVote", "comment_vote" = "CommentVote"}) */class Vote{ private $id; private $weight;}class ArticleVote extends Vote{ /** @ManyToOne(...) */ private $article;}class CommentVote extends Vote{ /** @ManyToOne(...) */ private $comment;}
answered Apr 29 '11 at 3:53 |
Just incase someone else needs it, here is an detailed example in using Table Inheritance with Doctrine. I found it more informative than the Doctrine documentation: