如何创建与 FOSUserBundle 的关系?FOS 在我的项目中运行良好。现在我创建我的 bundle 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.
如何创建与用户的关系?