1
0
mirror of synced 2024-12-13 06:46:03 +03:00

some more test models

This commit is contained in:
romanb 2008-08-31 18:28:22 +00:00
parent b5401ee1c5
commit 305d3b353f
2 changed files with 55 additions and 0 deletions

View 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'
));
}
}
?>

View File

@ -0,0 +1,14 @@
<?php
class CompanyManager extends CompanyEmployee
{
public static function initMetadata($mapping)
{
$mapping->mapColumn(array(
'fieldName' => 'title',
'type' => 'string'
));
}
}
?>