【问题标题】:unknown record property/related component "onwer" on "contact"“联系人”上的未知记录属性/相关组件“onwer”
【发布时间】:2012-07-26 10:03:30
【问题描述】:

当我尝试执行 php symfony doctrine:data-load 时,出现此消息:

“联系人”上的未知记录属性/相关组件“所有者”

这是我的 schema.yml :

Contact:
  connection: doctrine
  tableName: contact
  columns:
    id_contact:
      type: integer(2)

      fixed: false
      unsigned: false
      primary: true
      autoincrement: true
    nom:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    fonction_organisme:
      type: string(1000)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    categorie:
      type: string(300)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    region:
      type: string(1000)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    province:
      type: string(500)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    adresse:
      type: string(1000)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    tel1:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    tel2:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    tel3:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    tel4:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    email:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    fax:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    ville:
      type: string(50)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    journal:
      type: string(2000)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    commentaire:
      type: string(2000)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    fix:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    image:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    owner:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
  relations:
    Evenement:
      local: id_contact
      foreign: id_contact_event
      type: many
    users : 
      class : user
      refclass : operation_contact
      foreignAlias : contacts
Courrier:
  connection: doctrine
  tableName: courrier
  columns:
    num_serie:
      type: integer(2)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: false
    annee:
      type: integer(2)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: false
    num_c:
      type: integer(2)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    exp:
      type: string(500)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    dest:
      type: string(500)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    state:
      type: string(10)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    objet:
      type: string(1000)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    image_c:
      type: string(500)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    date_recep:
      type: date(25)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    date_env:
      type: date(25)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    owner_c:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    user_c:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    relations :
     users : 
      class : user
      refclass : operation_c
      foreignAlias : courriers
Evenement:
  connection: doctrine
  tableName: evenement
  columns:
    id_event:
      type: integer(2)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true
    date:
      type: date(25)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    action:
      type: string(2000)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    id_contact_event:
      type: integer(2)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
  relations:
    Contact:
      local: id_contact_event
      foreign: id_contact
      type: one
OperationC:
  connection: doctrine
  tableName: operation_c
  columns:
    id_user:
      type: integer(2)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: false
    num_serie:
      type: integer(2)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: false
    operation_c:
      type: string(2000)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    date_op_c:
      type: date(25)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    relations : 
      user : { onDelete : CASCADE}
      courrier : { onDelete : CASCADE }
OperationContact:
  connection: doctrine
  tableName: operation_contact
  columns:
    id_contact:
      type: integer(2)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: false
    id_user:
      type: integer(2)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: false
    operation:
      type: string(2000)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    date_op:
      type: date(25)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    relations : 
      user : { onDelete : CASCADE}
      contact : { onDelete : CASCADE }
User:
  connection: doctrine
  tableName: user
  columns:
    id_user:
      type: integer(2)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true
    nom_user:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    prenom_user:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    adresse_user:
      type: string(2000)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    tel_user:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    login:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    password:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false

这是我的夹具文件中的一个示例:

  contact :
    jihane:
       nom : jihane bahadi
       fonction_organisme : directrice
       categorie : autre
       region : meknes
       adresse : route de fes
       tel1 : 0654789632
       email : jihane.bahadi@gmail.com
       fix : 05698743255
       ville : meknes
       ouwner : user

【问题讨论】:

  • 是不是错字ouwner : user?应该是owner : user
  • 好吧,这只是一个例子,我会尝试改变这个“用户”,我会换个名字,我会看到!
  • 这是同样的问题,我已经把所有者:sara 和我有同样的问题
  • 你重建你的模型、类、数据库等了吗?
  • 我认为出现了另一个问题,当我尝试再次执行教义:insert-sql 时,我收到关于外键的错误错误 =

标签: doctrine symfony-1.4


【解决方案1】:

好吧,我不确定,但我认为这是因为您使用 owner 作为字段名称!(它会将 mySQL 与 owner Reserved wrod 混淆!)我记得有一次我使用了 group 这个词strong> 对于我的一个领域或模型,它引起了很多问题。但是当我改变这个名字时,一切都很好。只需更改模型架构中的 所有者,然后构建模型、表单等并重新创建表格并修复固定装置。我希望这能解决问题!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多