1
0
mirror of synced 2024-12-13 14:56:01 +03:00
doctrine2/tests_old/models/InheritanceDealUser.php

27 lines
1.2 KiB
PHP

<?php
class InheritanceEntityUser extends Doctrine_Entity
{
public static function initMetadata($class)
{
$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,));
}
}
class InheritanceDealUser extends InheritanceEntityUser
{
public static function initMetadata($class)
{
$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'));
}
}