1
0
mirror of synced 2024-12-17 00:18:42 +03:00
doctrine2/manual/docs/Object relational mapping - Relations - Join table associations - Self-referencing.php

19 lines
518 B
PHP
Raw Normal View History

2007-04-14 01:49:11 +04:00
Self-referencing with join tables is done as follows:
2007-04-14 01:49:11 +04:00
<code type="php">
class User extends Doctrine_Record {
public function setUp() {
$this->hasMany('User as Friend','UserReference.user_id-user_id2');
}
public function setTableDefinition() {
$this->hasColumn('name','string',30);
}
}
class UserReference extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('user_id','integer');
$this->hasColumn('user_id2','integer');
}
}
</code>