1
0
mirror of synced 2024-12-14 23:26:04 +03:00
doctrine2/manual/docs/Object relational mapping - Record identifiers - Composite.php

16 lines
631 B
PHP
Raw Normal View History

2007-04-14 01:49:11 +04:00
Composite primary key can be used efficiently in association tables (tables that connect two components together). It is not recommended
to use composite primary keys in anywhere else as Doctrine does not support mapping relations on multiple columns.
Due to this fact your doctrine-based system will scale better if it has autoincremented primary key even for association tables.
<code type="php">
class Groupuser extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('user_id', 'integer', 20, 'primary');
$this->hasColumn('group_id', 'integer', 20, 'primary');
}
}
</code>