English 中文(简体)
理论:布勒德--摩德尔和-塞克勒-克,但理论:sert-sql不是。 你们是否知道为什么?
原标题:doctrine:build --model and --sql ok but doctrine:insert-sql is not. Do you know why?

这里是我的图象文件:


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

感谢您的帮助。

最佳回答

你们的定义是错误的。

当地人应当成为本议席的外地人,而国外的田野——你们有这些错的轮。

通常,你只界定了关系的一个终点——理论汽车增加了反面,占到99%的时间。 如果你以人工方式这样做,他们必须做到。 在这种情况下,将该条关系从问题中删除,并从条款中删除评注。

Comments has no article id field.

外国语气是需要的,但你有错的回旋方式——在关系最接近尾声时,本表/标语将称为什么。 对目前物体名称的过失,经常会被忽视。

很少有其他小ni子。 在一位猜测中,我认为,这一图谋会是:

issue:
  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 }

article:
  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 }
    issueId: { type: integer(4) }
  relations:
    issue:
      local: issueId
      foreign: issueId
      foreignAlias: articles
      onDelete: cascade

comment:
  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 }
    articleId: { type: integer(4) }
  relations:
    article:
      local: articleId
      foreign: articleId
      onDelete: cascade
      foreignAlias: comments
问题回答

暂无回答




相关问题
XmlDocument.Validate ignore properties without [XmlIgnore]

I have a object that has a number of properties that aren t present in the xsd file. When doing XmlDocument.Validate is there a way I can tell it to ignore properties that are not present in the xsd ...

FOSS version of SQLCompare or something similar?

Actually, free is good enough, it doesn t have to be open source :) I m currently using the Schema Compare utility of VS2008, but it doesn t have a command line interface and has some other ...

How does Doctrine handle changes to the database schema?

In brief, what happens when you add a column to a table? What happens when you remove one? In more details, suppose you have the following: class User extends Doctrine_Record { public function ...

摘自XML Schema

我想要把复杂的XML化学仪编成册,并出口到C#文档中。

Using a schema other than dbo in LinqToSql Designer

Is there a way to specify in a data connection or the LinqToSql Designer a schema? Whenever I go to setup a data connection for LinqToSql there doesn t seem to be anyway to specify a schema and I ...

热门标签