I have a unique restriction on the SKU column in the options table. I have a form where I can edit several options with corresponding SKUs. The classic problem ( question and question ) is this (and affects MySQL):
Suppose you have two lines with values:
If you exchange two values ββin an edited collection, the unique test will succeed and the doctrine will release two updates.
The first will set SKU1 to SKU2 and will immediately fail with a unique restriction, because there are duplicate values ββof SKU2 and SKU2.
- SKU1 β SKU2 (unique constaint error)
- SKU2
What is the best way to solve it in Symfony 2.3 Form and Doctrine 2.4?
source share