这里是我的图象文件:
issues:
actAs: { Timestampable: ~ }
columns:
issueId: { type: integer(4), notnull: true, primary: true, autoincrement: true }
issueDateForPublish: { type: timestamp, notnull: true }
issueName: { type: string(255), notnull: true }
issueCoverArticleId: { type: integer(4), notnull: true }
relations:
articles:
class: articles
foreignAlias: article
local: articleId
foreign: issueId
type: many
articles:
actAs: { Timestampable: ~ }
columns:
articleId: { type: integer(4), notnull: true, primary: true, autoincrement: true }
articleTitle: { type: string(), notnull: true }
articleText: { type: string(), notnull: true }
articleDataForPublish: { type: timestamp, notnull: true }
articleIsDraft: { type: boolean, notnull: true, default: 1 }
articleIsOnHold: { type: boolean, notnull: true, default: 0 }
articleIsModerate: { type: boolean, notnull: true, default: 0 }
articleIsApprove: { type: boolean, notnull: true, default: 0 }
relations:
articles:
local: issueId
foreign: articleId
onDelete: cascade
comments:
class: comments
foreignAlias: comment
local: commentId
foreign: articleId
type: many
comments:
actAs: { Timestampable: ~ }
columns:
commentId: { type: integer(4), notnull: true, primary: true, autoincrement: true }
commentName: { type: string(255), notnull: true }
commentSurname: { type: string(255), notnull: true }
commentMail: { type: string(255), notnull: true }
commentDataForPublish: { type: timestamp }
commentIsModerated: { type: boolean, notnull: true, default: 0 }
commentIsApprove: { type: boolean, notnull: true, default: 0 }
relations:
articles:
local: articleId
foreign: commentId
onDelete: cascade
再者,如果一经实践,即:build -model和php symfony理论:build -sql则无坏。 “php symfony theory:insert-sql” 造成这一错误:
SQLSTATE[42000]: Syntax error or access violation: 1072 Key column issueid doesn t exist in table. Failing Query: "CREATE TABLE articles (articleid INT AUTO_INCREMENT, articletitle TEXT NOT NULL, articletext TEXT NOT NULL, articledataforpublish DATETIME NOT NULL, articleisdraft TINYINT(1) DEFAULT 1 NOT NULL, articleisonhold TINYINT(1) DEFAULT 0 NOT NULL, articleismoderate TINYINT(1) DEFAULT 0 NOT NULL, articleisapprove TINYINT(1) DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX issueid_idx (issueid), PRIMARY KEY(articleid)) ENGINE = INNODB". Failing Query: CREATE TABLE articles (articleid INT AUTO_INCREMENT, articletitle TEXT NOT NULL, articletext TEXT NOT NULL, articledataforpublish DATETIME NOT NULL, articleisdraft TINYINT(1) DEFAULT 1 NOT NULL, articleisonhold TINYINT(1) DEFAULT 0 NOT NULL, articleismoderate TINYINT(1) DEFAULT 0 NOT NULL, articleisapprove TINYINT(1) DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX issueid_idx (issueid), PRIMARY KEY(articleid)) ENGINE = INNODB
感谢您的帮助。