如何向Doctrine_记录类添加说明

如何向Doctrine_记录类添加说明,doctrine,symfony-1.4,Doctrine,Symfony 1.4,我有一个表CustBillingEmployee在下面的方案中描述 CustBillingEmployee: connection: doctrine tableName: cust_billing_employee columns: employee_num: type: integer(4) fixed: false unsigned: false primary: true autoincrement: fal

我有一个表CustBillingEmployee在下面的方案中描述

CustBillingEmployee:
  connection: doctrine
  tableName: cust_billing_employee
  columns:
    employee_num:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: false
    job_title_code:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    cost:
      type: 'decimal(5, 2)'
      fixed: false
      unsigned: false
      primary: false
      default: '0.00'
      notnull: true
      autoincrement: false
  relations:
    HsHrEmployee:
      local: employee_num
      foreign: emp_number
      type: one
下面的班级呢

class cust_billing_employee extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->hasColumn('employee_num', 'integer',4,array(
         'type' => 'integer',
         'length' => 4,
         'fixed' => false,
         'unsigned' => false,
         'primary' => true,
         'autoincrement' => false,
         ));
        $this->hasColumn('job_title_code', 'integer',4,array(
         'type' => 'integer',
         'length' => 4,
         'fixed' => false,
         'unsigned' => false,
         'primary' => false,
         'notnull' => true,
         'autoincrement' => false,
         ));
        $this->hasColumn('cost', 'decimal',5,array(
            'fixed' => false,
            'unsigned' => false,
            'primary' => false,
            'default' => '0.00',
            'notnull' => true,
            'autoincrement' => false,
        ));
    }

    public function setUp()
    {
        $this->hasOne('User', array(
            'local' => 'employee_num',
            'foreign' => 'emp_number'
        ));
    }

    public function __toString() {
       return "HI";
    }
}
当我尝试提取特定对象时,如下所示:

echo Doctrine::getTable('CustBillingEmployee')->find(1);
我犯了一个错误

No description for object of class "CustBillingEmployee"
我希望函数_toString()能够从父类中被重写,但事实并非如此。那么,我该如何为该对象添加描述


显示每个记录时,我希望能够显示员工姓名,而不是仅显示员工编号键和职位,而不是职位成本。您是否可以发布整个调用堆栈,是什么代码引发该错误

我怀疑的是类的名称
cust\u billing\u employee
不是
CustBillingEmployee
并且没有扩展
BaseCustBillingEmployee
,这将是Symfony 1.4的默认行为。这段代码是你“亲手”写的吗

因为您的模式是在schema.yml中定义的,所以您应该使用
/symfony原则:构建模型
任务

这应该生成正确的类:
CustBillingEmployee
扩展
BaseCustBillingEmployee
,它扩展了
sfDoctrineRecord
,然后
Doctrine\u Core::getTable('CustBillingEmployee')->find(1)
应该可以很好地工作

另外请注意,您不应触摸
BaseCustBillingEmployee
,因为这是自动生成的代码,所有修改(如
\uu toString
)都应在
CustBillingEmployee
类中完成