如何与FOSUserBundle建立关系? FOS在我的项目中运作良好。现在我创建我的包NewsBundle
。在NewsBundle/Resources/config/doctrine/News.orm.yml
我输入:
Josh\NewsBundle\Entity\News:
type: entity
table: news
id:
id:
type: integer
generator: { strategy: AUTO }
manyToOne:
user:
targetEntity: FOS\UserBundle\Entity\User
inversedBy: news
joinColumn:
name: user_id
referencedColumnName: id
fields:
name:
type: string
length: 100
我生成实体(没有错误),我尝试doctrine:schema:update
,我收到此错误:
[Doctrine\ORM\ORMException]
Column name `id` referenced for relation from Josh\NewsBundle\Entity\News towards FOS\UserBundle\Entity\User does not exist.
如何创建与用户的关系?
答案 0 :(得分:0)
您可以创建自己的用户实体,扩展Fos \ UserBundle \ Model \ User ......这就是我做的......