1
0
mirror of synced 2024-12-15 07:36:03 +03:00
doctrine2/manual/docs/Object relational mapping - Relations - Foreign key associations - One-to-Many, Many-to-One.php
2007-05-11 16:49:11 +00:00

20 lines
555 B
PHP

<code type="php">
class User extends Doctrine_Record {
public function setUp() {
$this->ownsMany('Phonenumber','Phonenumber.user_id');
}
public function setTableDefinition() {
$this->hasColumn('name','string',50);
$this->hasColumn('loginname','string',20);
$this->hasColumn('password','string',16);
}
}
class Phonenumber extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('phonenumber','string',50);
$this->hasColumn('user_id','integer');
}
}
</code>