Symfony - 使用accessgroup保存配置文件时出错 - Doctrine_Record_UnknownPropertyException

时间:2017-04-23 22:39:58

标签: php symfony doctrine symfony-2.1

当我尝试编辑具有一个或多个访问组的用户时,它会产生500内部服务器错误。

  

500 |内部服务器错误| Doctrine_Record_UnknownPropertyException   未知的记录属性/相关组件"

alias : Group
foreign : id
local : group_id
class : sfGuardGroup
type : 0
table : Object(sfGuardGroupTable)
localTable : Object(sfGuardUserGroupTable)
name : 
refTable : 
onDelete : CASCADE
onUpdate : 
deferred : 
deferrable : 
constraint : 
equal : 
cascade : Array
owningSide : 
refClassRelationAlias : 
foreignKeyName : 
orderBy : 
" on" sfGuardUserGroup"   堆栈跟踪   在 ()   在SF_ROOT_DIR / lib / vendor / symfony / lib / plugins / sfDoctrinePlugin / lib / vendor / doctrine / Doctrine / Record / Filter / Standard.php第55行......        * /       public function filterGet(Doctrine_Record $ record,$ name)       {           抛出新的Doctrine_Record_UnknownPropertyException(sprintf('未知记录属性/相关组件"%s" on"%s"',$ name,get_class($ record))) ;       }   }   在Doctrine_Record_Filter_Standard-> filterGet(object(' sfGuardUserGroup'),'别名:组外部:id local:group_id类:sfGuardGroup类型:0表:Object(sfGuardGroupTable)localTable:Object(sfGuardUserGroupTable) name:refTable:onDelete:CASCADE onUpdate:deferred:deferrable:constraint:equal:cascade:Array owningSide:refClassRelationAlias:foreignKeyName:orderBy:')   在SF_ROOT_DIR / lib / vendor / symfony / lib / plugins / sfDoctrinePlugin / lib / vendor / doctrine / Doctrine / Record.php第1395行......   at Doctrine_Record-> _get('< pre> alias:Group foreign:id local:group_id class:sfGuardGroup type:0 table:Object(sfGuardGroupTable)localTable:Object(sfGuardUserGroupTable)name:refTable:onDelete:CASCADE onUpdate :deferred:deferrable:constraint:equal:cascade:Array owningSide:refClassRelationAlias:foreignKeyName:orderBy:',1)   在SF_ROOT_DIR / lib / vendor / symfony / lib / plugins / sfDoctrinePlugin / lib / vendor / doctrine / Doctrine / Record.php第1350行......   在Doctrine_Record-> get('< pre>别名:Group foreign:id local:group_id class:sfGuardGroup type:0 table:Object(sfGuardGroupTable)localTable:Object(sfGuardUserGroupTable)name:refTable:onDelete:CASCADE onUpdate :deferred:deferrable:constraint:equal:cascade:Array owningSide:refClassRelationAlias:foreignKeyName:orderBy:')   在SF_ROOT_DIR / lib / vendor / symfony / lib / plugins / sfDoctrinePlugin / lib / vendor / doctrine / Doctrine / Access.php第72行......   at Doctrine_Access-> __ get('< pre> alias:Group foreign:id local:group_id class:sfGuardGroup type:0 table:Object(sfGuardGroupTable)localTable:Object(sfGuardUserGroupTable)name:refTable:onDelete:CASCADE onUpdate :deferred:deferrable:constraint:equal:cascade:Array owningSide:refClassRelationAlias:foreignKeyName:orderBy:')   在SF_ROOT_DIR / lib / vendor / symfony / lib / plugins / sfDoctrinePlugin / lib / vendor / doctrine / Doctrine / Collection.php第463行......   在Doctrine_Collection->添加(对象(' sfGuardUserGroup'))   在SF_ROOT_DIR / lib / vendor / symfony / lib / plugins / sfDoctrinePlugin / lib / vendor / doctrine / Doctrine / Access.php第131行......

我已将UserGroup添加到sfguard shema.yml,但仍然出现此错误。

db上的表确实具有表组ID的用户组外键。 第一版将行插入表中。

如果我尝试使用该用户(登录它),我总会得到403错误。

我对symfony一无所知,也不知道如何解决这个错误。

我的shema.yml是

sfGuardGroup:
  actAs: [Timestampable]
  columns:
    name:
      type: string(255)
      unique: true
    description: string(1000)
  relations:
    Users:
      class: sfGuardUser
      refClass: sfGuardUserGroup
      local: group_id
      foreign: id
      foreignAlias: Groups
    Permissions:
      class: sfGuardPermission
      local: permission_id
      foreign: id
      refClass: sfGuardGroupPermission
      foreignAlias: Groups

sfGuardPermission:
  actAs: [Timestampable]
  columns:
    empresa_id:
      type: integer
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
      default: 1
    name:
      type: string(255)
      unique: true
    description: string(1000)
    detalles:
      type: enum
      fixed: false
      unsigned: false
      primary: false
      autoincrement: false
      values: ['1', '2', '3', '4', '5',  '6','7']
    status:
      type: integer(1)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
  relations:
    Empresa:
      local: empresa_id
      foreign: id
      type: one
      foreignType: many
      onDelete: CASCADE
      onUpdate: CASCADE

sfGuardGroupPermission:
  options:
    symfony:
      form:   false
      filter: false
  actAs: [Timestampable]
  columns:
    group_id:
      type: integer
      primary: true
    permission_id:
      type: integer
      primary: true
  relations:
    Group:
      class: sfGuardGroup
      local: group_id
      onDelete: CASCADE
    Permission:
      class: sfGuardPermission
      local: permission_id
      onDelete: CASCADE

sfGuardUser:
  actAs: [Timestampable]
  columns:
    first_name: string(255)
    last_name: string(255)
    identificacion: string(50)
    fecha_nacimiento: date
    direcion: string()
    telefono_principal: string(50)
    telefono_adicional: string(50)
    telefono_emergencia: string(50)
    telefono_familiar: string(50)
    sexo: integer(1)
    edo_civil: string(50)
    licencia_conducir: 
      type: string(50)
      notnull: false
    licencia_conducir_fecha: 
      type: date
      notnull: false
    nacionalidad: string(50)
    empresa_id:
      type: integer
      notnull: true
    area_id:
      type: integer
      notnull: false
    ocupacion:
      type: string(50)
      notnull: true
      default: 1
    titulo:
      type: string(50)
      notnull: true
      default: 1
    grado_instruccion:
      type: string(50)
      notnull: true
      default: 1
    ingreso:
      type: date
      notnull: true
    salida:
      type: date
      notnull: false
    email_address:
      type: string(255)
      notnull: true
      unique: true
    username:
      type: string(128)
      notnull: true
      unique: true
    algorithm:
      type: string(128)
      default: sha1
      notnull: true
    salt: string(128)
    password: string(128)
    identificacion_archivo: 
      type: string(50)
      notnull: false
    domicilio_archivo: 
      type: string(50)
      notnull: false
    foto_archivo: 
      type: string(50)
      notnull: false
    is_active:
      type: boolean
      default: 1
    is_super_admin:
      type: boolean
      default: false
    last_login:
      type: timestamp
    alerta: 
      type: string()
      notnull: false
    observacion:
      type: string()
      fixed: false
      unsigned: false
      primary: false
      autoincrement: false
      notnull: false
  indexes:
    is_active_idx:
      fields: [is_active]
  relations:
    Groups:
      class: sfGuardGroup
      local: group_id
      foreign: id
      refClass: sfGuardUserGroup
      foreignAlias: Users
    Permissions:
      class: sfGuardPermission
      local: user_id
      foreign: permission_id
      refClass: sfGuardUserPermission
      foreignAlias: Users
    Empresa:
      local: empresa_id
      foreign: id
      type: one
      onDelete: CASCADE
      onUpdate: CASCADE 
    Area:
      local: area_id
      foreign: id
      type: one
      onDelete: NULL
      onUpdate: NULL 

sfGuardUserPermission:
  options:
    symfony:
      form:   false
      filter: false
  actAs: [Timestampable]
  columns:
    user_id:
      type: integer
      primary: true
    permission_id:
      type: integer
      primary: true
  relations:
    User:
      class: sfGuardUser
      local: user_id
      onDelete: CASCADE
    Permission:
      class: sfGuardPermission
      local: permission_id
      onDelete: CASCADE

sfGuardUserGroup:
  options:
    symfony:
      form:   false
      filter: false
  actAs: [Timestampable]
  columns:
    user_id:
      type: integer
      primary: true
    group_id:
      type: integer
      primary: true
  relations:
    User:
      class: sfGuardUser
      local: user_id
      onDelete: CASCADE
    Group:
      class: sfGuardGroup
      local: group_id
      onDelete: CASCADE

sfGuardRememberKey:
  options:
    symfony:
      form:   false
      filter: false
  actAs: [Timestampable]
  columns:
    user_id: integer
    remember_key: string(32)
    ip_address: string(50)
  relations:
    User:
      class: sfGuardUser
      local: user_id
      foreignAlias: RememberKeys
      foreignType: one
      onDelete: CASCADE

sfGuardForgotPassword:
  options:
    symfony:
      form:   false
      filter: false
  actAs: [Timestampable]
  columns:
    user_id:
      type: integer
      notnull: true
    unique_key: string(255)
    expires_at:
      type: timestamp
      notnull: true
  relations:
    User:
      class: sfGuardUser
      local: user_id
      type: one
      foreignType: one
      foreignAlias: ForgotPassword
      onDelete: CASCADE

有人可以为sfGuard提供他的shema.yml吗?

请帮帮我! 感谢

0 个答案:

没有答案