mysql - 禁用Doctrine 1.2中的自动Id字段生成

标签 mysql symfony1 doctrine

我将Symfony 1.4与Doctrine 1.2结合使用,并且具有yaml格式的下表:

Log:
  options:
    type:             ARCHIVE
  actAs:              
    Timestampable:    
      updated:
        disabled: true
  tableName:          user_log
  columns:
    event:       integer(4)
    user_id:     integer(4)
    ip:          integer(5)
    country:     string(2)
    message:     string(100)


问题是我不需要由教义生成的ID字段,因为ARCHIVE存储引擎不允许索引,自动增量值或主键。我在教义文档中找不到如何禁用此行为。

有谁知道我该如何处理这个问题?我发现的唯一方法是添加一个虚拟主键(例如,将created_ateventuser_id作为yaml中的主键),然后修改生成的SQL以删除“ PRIMARY KEY”语句但是我认为这不是一个很好的解决方案。

最佳答案

只要我知道Doctrine,至少是Doctrine 1.2,就会迫使您在所有表中都具有主键。我在文档中找不到有关将其设置为false的任何信息。您可以看到一个相关的问题here

关于mysql - 禁用Doctrine 1.2中的自动Id字段生成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6668952/

相关文章:

php - 查询返回不存在的行

mysql - Doctrine :构建模式忽略表列

orm - Doctrine ORM Single Table Inheritance association problem (always Eager loading contractoring to documentation))

php - 生成错误 INSERT 语句的 Doctrine

php - 按顺序更改组

mysql - 优化 mySQL LEFT JOIN

mysql - 多对多关系中的查询

php - PHP |更新查询给我 undefined index :

symfony1 - 如何在 symfony 中修改/添加帖子参数?

sql - 如何在查询中使用 "case when"