Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在doctrine中获取表实例的替代方法_Php_Symfony1_Doctrine - Fatal编程技术网

Php 在doctrine中获取表实例的替代方法

Php 在doctrine中获取表实例的替代方法,php,symfony1,doctrine,Php,Symfony1,Doctrine,在某些情况下,Core::getTable“%Name%”返回 表实例,而不是%Name%表实例。这显然是一个bug,但是除了doctrine_Core::getTable“%Name%”之外,还有其他方法可以获取doctrine中的表实例吗 为了演示这种不恰当的行为:下面是一个小问题的模式 跟踪系统 User: actAs: [Timestampable] tableName: issue_user columns: user_id: { type: inte

在某些情况下,Core::getTable“%Name%”返回 表实例,而不是%Name%表实例。这显然是一个bug,但是除了doctrine_Core::getTable“%Name%”之外,还有其他方法可以获取doctrine中的表实例吗

为了演示这种不恰当的行为:下面是一个小问题的模式 跟踪系统

User:
  actAs: [Timestampable]
  tableName: issue_user
  columns:
    user_id:        { type: integer, primary: true, autoincrement: true }
    user_name:      { type: string(255) }
    user_role:      { type: enum, values: [worker, dispatcher, manager] }
    managed_by:     { type: integer }
    password:       { type: string(32) }
    salt:           { type: string(32) }
  relations:
    Manager:
      foreignAlias: Workers
      class: User
      local: managed_by
      foreign: user_id
      type: one
      foreignType: many

Issue:
  actAs: [Timestampable]
  columns:
    issue_id:        { type: integer, primary: true, autoincrement: true }
    from_ceh:        { type: string(255) }
    from_name:       { type: string(255) }
    from_phone:      { type: string(255) }
    from_location:   { type: string(255) }
    comp_name:       { type: string(255) }
    comp_serial:     { type: string(255) }
    comp_os:         { type: enum, values: [Win95, Win98, WinNT, WinME, Win2000, WinXP, Vista, Win7] }
    issue_title:     { type: string(255) }
    comment:         { type: string(255) }
    owner_id:        { type: integer }
    is_executed:     { type: bool }
  relations:
    Owner:
      onDelete: CASCADE
      foreignAlias: Issues
      class: User
      local: owner_id
      foreign: user_id
      type: one
      foreignType: many
当我调用doctor_Core::getTable'User'时,它返回UserTable 实例,但如果我在这样一个查询之后调用它:

Doctrine_Query::create()
        ->select('u.user_id, ws.user_id, i.*')
        ->from('User u, u.Workers ws, ws.Issues i')
        ->where('u.user_id=', $manager_id)
        ->fetchArray();
调用Doctrine\u Core::getTable'User'返回Doctrine\u表 实例


p.S.条令1.2.3

听起来您正在使用的条令1.2的最新版本支持XxxTable::getInstance,尽管它只调用条令::getTable'Xxx'

为什么不报告这个错误?和/或链接到bug跟踪器?我错了吗,或者fetchArray返回的是数组,而不是对象?这一切都取决于使用过的水合器。不要使用水合器,你会得到同样的结果。