1
0
mirror of synced 2024-12-15 07:36:03 +03:00
doctrine2/tests_old/models/InheritanceDealUser.php

27 lines
1.2 KiB
PHP
Raw Normal View History

2007-09-13 00:50:39 +04:00
<?php
class InheritanceEntityUser extends Doctrine_Entity
2007-09-13 00:50:39 +04:00
{
public static function initMetadata($class)
2007-09-13 00:50:39 +04:00
{
2008-03-23 14:30:29 +03:00
$class->setInheritanceType(Doctrine::INHERITANCE_TYPE_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
{
public static function initMetadata($class)
2007-09-13 00:50:39 +04: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
}
}