We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9390332 + 78a15a7 commit 7ddddbcCopy full SHA for 7ddddbc
src/Infrastructure/Model/Repository/Sql/SqlWriteRepository.php
@@ -43,12 +43,14 @@ public function add(Identity $value)
43
{
44
try {
45
$this->updateQuery($value);
46
+ $insert = false;
47
} catch (PDOException $e) {
48
$this->insertQuery($value);
49
+ $insert = true;
50
}
51
52
$id = $value->id();
- if ($this->mapping->autoGenerateId()) {
53
+ if (($insert) && ($this->mapping->autoGenerateId())) {
54
$id = $this->queryBuilder()->getConnection()->lastInsertId();
55
56
0 commit comments