聘我网

新概念招聘3.0

doctrine调用save时报错“validator failed”

vote up0vote downstar

YAML如下:

Note:
  options:
    type: MyISAM
    collate: utf8_unicode_ci
    charset: utf8
  actAs: { Timestampable: ~ }
  columns:
    content: { type: string, notnull: true}
    order_id: int
    user_id : int
  relations:
    User:
      foreignAlias: Notes
      local: user_id
      foreign: id
      type: one
      foreignType: man
      onDelete: CASCADE

结果调用

$note->save();

报错:

1 validator failed on order_id (type)
 

1 个答复

vote up0vote downcheck

doctrine有效的数据类型是:

"boolean", "integer", "float", "decimal", "string", "array", "object", "blob", "clob", "timestamp", "time", "date", "enum", "gzip"(source)

然后自动转化成对应DBMS中的类型。

所以YAML中的int需要换成integer

链接

您的回答





不是您要找的问题? 浏览其他含有标签 的问题或者 自己问个.