Object relational mapping - Relations - Inheritance - Column aggregation.php 697 Bytes
Newer Older
doctrine's avatar
doctrine committed
1 2 3 4 5 6 7
<?php
class Entity extends Doctrine_Record { 
    public function setTableDefinition() {
        $this->hasColumn("name","string",30);
        $this->hasColumn("username","string",20);
        $this->hasColumn("password","string",16);
        $this->hasColumn("created","integer",11);
zYne's avatar
zYne committed
8 9 10 11
        
        // this column is used for column 
        // aggregation inheritance
        $this->hasColumn("type", "integer", 11);
doctrine's avatar
doctrine committed
12 13 14 15 16
    }
}

class User extends Entity {
    public function setUp() {
zYne's avatar
zYne committed
17
        $this->setInheritanceMap(array("type"=>1));
doctrine's avatar
doctrine committed
18 19 20 21 22
    }
}

class Group extends Entity {
    public function setUp() {
zYne's avatar
zYne committed
23
        $this->setInheritanceMap(array("type"=>2));
doctrine's avatar
doctrine committed
24 25 26
    }
}
?>