我的实体代码:
GameShelf\GamesBundle\Entity\Game:
type: entity
table: games
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
parent_id:
type: integer
length: 11
name:
type: string
length: 200
slug:
type: string
length: 200
reldate:
type: date
genres:
type: text
platforms:
type: text
developers:
type: text
desc:
type: text
desc_src:
type: text
rate:
string: integer
lenght: 10
我运行php app/console doctrine:generate:entities GameShelf\GamesBundle\Entity\Game
并返回Namespace "GameShelf\GamesBundle\Entity\Game" does not contain any mapped entities.
。怎么了?我跟着the docs here。
答案 0 :(得分:7)
请参阅Game.orm.yml文件的以下代码。
GameShelf\GamesBundle\Entity\Game:
type: entity
table: null
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
parent_id:
type: integer
length: 11
name:
type: string
length: 200
slug:
type: string
length: 200
reldate:
type: datetime
genres:
type: text
platforms:
type: text
developers:
type: text
desc:
type: text
desc_src:
type: text
rate:
type: integer
length: 10
以下内容已得到纠正,可能有助于解决您的问题。
在我自己的配置上测试了正确的YAML,并且能够使用以下命令创建实体:
app/console generate:doctrine:entities --no-backup <Your Bundle>
app/console doctrine:schema:update --dump-sql
app/console doctrine:schema:update --force