Commit ab38654e authored by zYne's avatar zYne

--no commit message

--no commit message
parent 39f33a87
++ Introduction ++ Introduction
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 ++ Relation aliases
...@@ -18,8 +18,8 @@ class Forum_Board extends Doctrine_Record ...@@ -18,8 +18,8 @@ class Forum_Board extends Doctrine_Record
public function setUp() public function setUp()
{ {
// notice the 'as' keyword here // 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'); 'foreign' => 'board_id');
} }
} }
...@@ -56,8 +56,8 @@ class User extends Doctrine_Record ...@@ -56,8 +56,8 @@ class User extends Doctrine_Record
public function setUp() public function setUp()
{ {
$this->hasOne('Address', array('local' => 'id', 'foreign' => 'user_id')); $this->hasOne('Address', array('local' => 'id', 'foreign' => 'user_id'));
$this->ownsOne('Email', array('local' => 'email_id', 'foreign' => 'id')); $this->hasOne('Email', array('local' => 'email_id', 'foreign' => 'id'));
$this->ownsMany('Phonenumber', array('local' => 'id', 'foreign' => 'user_id')); $this->hasMany('Phonenumber', array('local' => 'id', 'foreign' => 'user_id'));
} }
public function setTableDefinition() public function setTableDefinition()
{ {
...@@ -94,7 +94,7 @@ class User extends Doctrine_Record ...@@ -94,7 +94,7 @@ class User extends Doctrine_Record
{ {
public function setUp() public function setUp()
{ {
$this->ownsMany('Phonenumber', array('local' => 'id', 'foreign' => 'user_id')); $this->hasMany('Phonenumber', array('local' => 'id', 'foreign' => 'user_id'));
} }
public function setTableDefinition() public function setTableDefinition()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment