Symfony doctrine を使用してテーブルを更新すると、「整合性制約違反: 1062 エントリが重複しています ... キー 'PRIMARY' の場合」というエラーが発生することがあります。テーブルは、対応する履歴テーブルで作成されます。エラーは、テーブル自体の更新によるものではなく、履歴テーブルへのレコードの挿入によるものです。私は Symfony 1.4、doctrine 1.2 を使用しています。何がこれを引き起こしているのですか?ありがとう。
$this->computer = $computerTable->findOneByMacAddress($this->props['mac_address']);
$this->computer->ip_address = $this->ip;
$this->computer->setLastCheckinAt(date('Y-m-d H:i:s')) ;
$this->computer->save();
schema.yml
Computer:
actAs:
Timestampable: ~
History:
className: %CLASS%History
auditLog: true
deleteVersions: false
cascadeDelete: false
columns:
mac_address: { type: string(13), notnull: true, }
last_checkin_at: { type: string(60), }
ip_address: { type: string(40), fixed: false, notnull: false, }
...