1
我有一個symfony的1.4設置有問題:無效行密鑰指定,數據加載夾具誤差的Symfony 1.4
我創建的schema.yml:
BlogCategory:
actAs: { Timestampable: ~ }
columns:
name: { type: string(255), notnull: true, unique: true }
BlogPost:
actAs: { Timestampable: ~ }
columns:
category_id: { type: integer, notnull: true }
title: { type: string(255), notnull: true }
body: { type: string(255), notnull: true }
relations:
BlogCategory: { onDelete: CASCADE, local: category_id, foreign: id, foreignAlias: BlogPosts }
(基於Jobeet的教程)
那麼它產生了我的表schema.sql文件:
CREATE TABLE blog_category (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255) NOT NULL UNIQUE, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL);
CREATE TABLE blog_post (id INTEGER PRIMARY KEY AUTOINCREMENT, category_id INTEGER NOT NULL, title VARCHAR(255) NOT NULL, body VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL);
,似乎我的權利。
而完成我嘗試添加固定裝置和加載數據,我的燈具如下:
數據/夾具/ categories.yml:
BlogCategory:
design:
name: Design
programming:
name: Programming
management:
name: Management
administrator :
name: Administrator
數據/夾具/職位.yml
BlogPost:
initial_post_1:
BlogCategory : design
title: Initial post 1
body: This post is an initial test number 1
initial_post_2:
BlogCategory : design
title: Initial post 2
body: This post is an initial test number 2
在PHP symfony的教義:數據加載命令生成我類別而不是職位,所以我嘗試:
php symfony doctrine:data-load data/fixtures/posts.yml
無效行鍵規定:(blog_category)設計,在 (blog_post)簡稱initial_post_1
任何想法,爲什麼我不能讚美帖子?我已經試圖刪除數據庫重新生成等...