down votehtml |
You can see in this link to know about inheritance: http://docs.doctrine-project.org/en/latest/reference/inheritance-mapping.html#single-table-inheritanceapp You must declare in UserBundle\Entity\User:post /** * @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\Userthis use App\UserBundle\Entity\User as BaseUser; /** * @ORM\Entity */ class User extends BaseUser { .... } Goodluck!code |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////orm
http://stackoverflow.com/questions/5823905/how-to-manage-single-table-inheritance-within-doctrine-2htm
--------------------------------------------------------blog
Based on the example from the docs:ip
/** * @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:
http://blog.liip.ch/archive/2012/03/27/table-inheritance-with-doctrine.html