Doktrinde Tablo-örneği almak için alternatif yollar

0 Cevap php

In some circumstances Doctrine_Core::getTable('%Name%') returns Doctrine_Table instance instead of %Name%Table one. It's obviously a bug, but are there other ways of getting Table-instances in doctrine besides Doctrine_Core::getTable('%Name%') ?

In order to give a demonstration of this improper behavior : here is schema of small issue tracking system

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

When I just call Doctrine_Core::getTable('User') it returns UserTable instance, but if I call it after such a query:

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();

calling Doctrine_Core::getTable('User') returns Doctrine_Table instance

P.S. Doktrin 1.2.3

0 Cevap