some more test models
This commit is contained in:
parent
b5401ee1c5
commit
305d3b353f
41
tests/models/company/CompanyEmployee.php
Normal file
41
tests/models/company/CompanyEmployee.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
class CompanyEmployee extends Doctrine_Entity
|
||||
{
|
||||
#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'
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
14
tests/models/company/CompanyManager.php
Normal file
14
tests/models/company/CompanyManager.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
class CompanyManager extends CompanyEmployee
|
||||
{
|
||||
public static function initMetadata($mapping)
|
||||
{
|
||||
$mapping->mapColumn(array(
|
||||
'fieldName' => 'title',
|
||||
'type' => 'string'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user