开发者

How can I modify the primary key name in Doctrine

开发者 https://www.devze.com 2023-01-26 05:33 出处:网络
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

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

精彩评论

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