开发者

How can I modify the primary key name in Doctrine

The Doctrine will set "id" as the default primary key, how can I modify it? My table only has two colums, there are "type_cod开发者_运维知识库e" and "type_name", and "type_code" is the prmary key.


here is sample table definition would help you :)

class typetable extends Doctrine_Record
{
public function setTableDefinition()
{
  $this->setTableName('your table name ');
  $this->hasColumn('type_code', 'integer', 8, array('type' => 'integer',
  'length' => 8, 'primary' => true, 'autoincrement' => true));
  $this->hasColumn('type_name', 'string', 255, array('type' =>
  'string', 'length' => 255));
}
 /////   extra code here ...... 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜