Symfony1 YML-Symfony 1.4.12中的固定ID问题

Symfony1 YML-Symfony 1.4.12中的固定ID问题,symfony1,doctrine,yaml,fixtures,Symfony1,Doctrine,Yaml,Fixtures,我有以下固定文件: Category: webDev: name: Development Web webDesign: name: Web Desing Autres: name: Autres Post: Post1: Category: webDev title: Ceci est un Test 1 content: TEST Post2: Category: webDes

我有以下固定文件:

Category:
   webDev:
      name: Development Web
   webDesign:
      name: Web Desing
   Autres:
      name: Autres

Post:
   Post1:
      Category: webDev
      title: Ceci est un Test 1
      content: TEST
   Post2:
      Category: webDesign
      title: Ceci est un Test 2
      content: TEST
   Post3:
      Category: Autres
      title: Ceci est un Test 3
      content: TEST
问题是webDev无法识别,并且id也没有自动设置

我不想这样使用:

 Post1:
      category_id: 1
      title: Ceci est un Test 1
      content: TEST
但是我想使用
webDev
webDesign
Autres
类别名称。正在运行,运行时没有错误:

./symfony doctrine:build --all --no-confirmation --and-load 
然而,当我查看MySQL数据库而不是类别
id
时,我得到
NULL
。为什么?错误在哪里

这是我的
schema.yml

Category:
 tableName: categories
 columns:
  name: string(100)

Post:
 tableName: posts
 actAs:
  Timestampable: ~
  Sluggable:
   fields: [title]
 columns:
  category_id: integer
  title: string(100)
  content: text
 relations:
  Category:
   type: one
   foreignType: many
   local: id
   foreign: id

根据您的模式,外键将设置为post.id,而不是post.category\u id


尝试
local:category\u id
而不是
local:id

根据您的模式,外键将设置为post.id而不是post.category\u id


尝试
local:category\u id
而不是
local:id

你能为post和category提供你的模式吗?我用我的模式更新了这个问题。我想如果你在post中定义“category\u id”,那么你的“local”id应该是类别关系的“category\u id”,不应该吗?@Flask可以将其作为一个答案提交;在你有了查看模式的聪明想法后,我刚刚插嘴,这是最重要的一点:)@Matt Gibson你是对的,这就是问题所在。你能为帖子和分类提供你的模式吗?我已经用我的模式更新了这个问题。我想如果你在帖子中定义“category\u id”,那么你的“local”id应该是“category\u id”对于类别关系,不是吗?@Flask可以将其作为答案提交;在你有了查看模式的聪明想法之后,我刚刚插嘴,这是最重要的一点:)@Matt Gibson你是对的,这就是问题所在。