2008-08-31 22:28:22 +04:00
|
|
|
<?php
|
|
|
|
|
2008-12-18 17:08:11 +03:00
|
|
|
class CompanyEmployee
|
2008-08-31 22:28:22 +04:00
|
|
|
{
|
|
|
|
#protected $id;
|
|
|
|
#protected $salary;
|
|
|
|
#protected $department;
|
|
|
|
|
|
|
|
public static function initMetadata($mapping)
|
|
|
|
{
|
|
|
|
// inheritance mapping
|
|
|
|
$mapping->setInheritanceType('joined', array(
|
|
|
|
'discriminatorColumn' => 'dtype',
|
|
|
|
'discriminatorMap' => array(
|
|
|
|
'emp' => 'CompanyEmployee',
|
|
|
|
'man' => 'CompanyManager')
|
|
|
|
));
|
|
|
|
// register subclasses
|
|
|
|
$mapping->setSubclasses(array('CompanyManager'));
|
|
|
|
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'id',
|
|
|
|
'type' => 'integer',
|
|
|
|
'length' => 4,
|
|
|
|
'id' => true,
|
|
|
|
'idGenerator' => 'auto'
|
|
|
|
));
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'salary',
|
|
|
|
'type' => 'double'
|
|
|
|
));
|
|
|
|
//TODO: make department an entity
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'department',
|
|
|
|
'type' => 'string'
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|