InheritanceDealUser.php 1.14 KB
Newer Older
Jonathan.Wage's avatar
Jonathan.Wage committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
<?php
class InheritanceEntityUser extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $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()
    {
        parent::setTableDefinition();

        $this->setTableName('inheritance_entity_user');

        $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'));
        $this->setInheritanceMap(array (
        'type' => 1,
        ));
    }
}