DDC-3951: Data concurrency because doctrine use SET column_name = value instead of SET column_name = column_name + difference_value #4834

Open
opened 2026-01-22 14:50:14 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Oct 13, 2015).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user hendrahuang:

I am using doctrine2 with symfony2. I have problem about data concurrency. Here is my case.

I create a website for ecommerce. Lets say I have product A with quantity = 5. Customer A buy 4 items of product A and Customer B buy 2 items of product A at the same time.
For customer A case, first doctrine query product A and the initial quantity is 5. Then doctrine update the quantity and set it to 1 (5 - 4).
For customer B case, the initial quantity of product A is still 5 because customer B and customer A buy that product at the same time, so they get the same initial quantity. Then doctrine update the quantity to 3 (5 - 2).

Originally created by @doctrinebot on GitHub (Oct 13, 2015). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user hendrahuang: I am using doctrine2 with symfony2. I have problem about data concurrency. Here is my case. I create a website for ecommerce. Lets say I have product A with quantity = 5. Customer A buy 4 items of product A and Customer B buy 2 items of product A at the same time. For customer A case, first doctrine query product A and the initial quantity is 5. Then doctrine update the quantity and set it to 1 (5 - 4). For customer B case, the initial quantity of product A is still 5 because customer B and customer A buy that product at the same time, so they get the same initial quantity. Then doctrine update the quantity to 3 (5 - 2).
admin added the Bug label 2026-01-22 14:50:14 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4834