Commit 128c6a5
authored
(Bugfix?): Attempt to fix UniqueConstraintViolationExceptions on import via WebHook (Case 205891) (#60)
When reassigning collections of objects in Doctrine entities, this can
create problems with unique constraints if the new collection contains
objects with data already present to the old one, but the object does
not share the same reference in memory. In this case, Doctrine tries to
add the new objects first when saving the collection, leading to
duplicate entries in the database.
We see issues that look exactly like this in our production log on a
regular basis, and this assignment looks exactly like the one causing
the problem. But I couldn't reproduce the issue, so I couldn't test if
this fixes it.
I'm still going to roll it out – if it doesn't fix the issue (or
introduces new ones), we will see this in our logs.1 file changed
+19
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
| 130 | + | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
| 136 | + | |
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
139 | | - | |
| 140 | + | |
140 | 141 | | |
| 142 | + | |
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
144 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
145 | 149 | | |
146 | | - | |
147 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
148 | 160 | | |
149 | 161 | | |
150 | 162 | | |
| |||
0 commit comments