In Doctrine all record relations are being set with {{hasMany}}, {{hasOne}}, {{ownsMany}} and {{ownsOne}} methods. Doctrine supports almost any kind of database relation from simple one-to-one foreign key relations to join table self-referencing relations.
In Doctrine all record relations are being set with {{hasMany}}, {{hasOne}} methods. Doctrine supports almost any kind of database relation from simple one-to-one foreign key relations to join table self-referencing relations.
++ Relation aliases
...
...
@@ -18,7 +18,7 @@ class Forum_Board extends Doctrine_Record
public function setUp()
{
// notice the 'as' keyword here
$this->ownsMany('Forum_Thread as Threads', array('local' => 'id',
$this->hasMany('Forum_Thread as Threads', array('local' => 'id',
'foreign' => 'board_id');
}
}
...
...
@@ -56,8 +56,8 @@ class User extends Doctrine_Record