2007-09-13 00:50:39 +04:00
|
|
|
<?php
|
|
|
|
class InheritanceEntityUser extends Doctrine_Record
|
|
|
|
{
|
2008-02-04 00:29:57 +03:00
|
|
|
public static function initMetadata($class)
|
2007-09-13 00:50:39 +04:00
|
|
|
{
|
2008-02-04 00:29:57 +03:00
|
|
|
$class->setInheritanceType(Doctrine::INHERITANCETYPE_SINGLE_TABLE, array(
|
|
|
|
'discriminatorColumn' => 'type',
|
|
|
|
'discriminatorMap' => array(1 => 'InheritanceDealUser', 2 => 'InheritanceEntityUser')
|
|
|
|
));
|
|
|
|
$class->setSubclasses(array('InheritanceDealUser'));
|
|
|
|
$class->setTableName('inheritance_entity_user');
|
|
|
|
$class->setColumn('type', 'integer', 4, array ( 'primary' => true,));
|
|
|
|
$class->setColumn('user_id', 'integer', 4, array ( 'primary' => true,));
|
|
|
|
$class->setColumn('entity_id', 'integer', 4, array ( 'primary' => true,));
|
2007-09-13 00:50:39 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class InheritanceDealUser extends InheritanceEntityUser
|
|
|
|
{
|
2008-02-04 00:29:57 +03:00
|
|
|
public static function initMetadata($class)
|
2007-09-13 00:50:39 +04:00
|
|
|
{
|
2008-02-04 00:29:57 +03:00
|
|
|
$class->setColumn('user_id', 'integer', 4, array ( 'primary' => true,));
|
|
|
|
$class->setColumn('entity_id', 'integer', 4, array ( 'primary' => true,));
|
|
|
|
$class->hasOne('InheritanceUser as User', array('local' => 'user_id', 'foreign' => 'id'));
|
|
|
|
$class->hasOne('InheritanceDeal as Deal', array('local' => 'entity_id', 'foreign' => 'id'));
|
2007-09-13 00:50:39 +04:00
|
|
|
}
|
|
|
|
}
|