我有以下机制如何描述添加到Doctrine_Record类
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
描述表CustBillingEmployee及以下
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()被父类覆盖,但事实并非如此。那么我应该如何向对象添加一个描述?
当显示我希望能够以显示员工姓名的每个记录,而不是仅仅employee_num键和职位,而不是job_title_cost的