2007-09-13 00:50:39 +04:00
|
|
|
<?php
|
|
|
|
class InheritanceEntityUser extends Doctrine_Record
|
|
|
|
{
|
|
|
|
public function setTableDefinition()
|
|
|
|
{
|
2008-01-05 22:55:56 +03:00
|
|
|
$this->setInheritanceType(Doctrine::INHERITANCETYPE_SINGLE_TABLE,
|
|
|
|
array('InheritanceDealUser' => array('type' => 1)));
|
|
|
|
|
2007-09-13 00:50:39 +04:00
|
|
|
$this->setTableName('inheritance_entity_user');
|
|
|
|
|
|
|
|
$this->hasColumn('type', 'integer', 4, array ( 'primary' => true,));
|
|
|
|
$this->hasColumn('user_id', 'integer', 4, array ( 'primary' => true,));
|
|
|
|
$this->hasColumn('entity_id', 'integer', 4, array ( 'primary' => true,));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class InheritanceDealUser extends InheritanceEntityUser
|
|
|
|
{
|
|
|
|
public function setTableDefinition()
|
|
|
|
{
|
|
|
|
$this->hasColumn('user_id', 'integer', 4, array ( 'primary' => true,));
|
|
|
|
$this->hasColumn('entity_id', 'integer', 4, array ( 'primary' => true,));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
$this->hasOne('InheritanceUser as User', array('local' => 'user_id', 'foreign' => 'id'));
|
|
|
|
$this->hasOne('InheritanceDeal as Deal', array('local' => 'entity_id', 'foreign' => 'id'));
|
|
|
|
}
|
|
|
|
}
|