mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Doctrine referenced objects inserting null instead of value #5533
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @smilesrg on GitHub (May 10, 2017).
Originally assigned to: @Ocramius on GitHub.
Here is a complex case. I have an RabbitMQ consumer, which processes messages using Doctrine2. Here is the steps:
Error "An exception occurred while executing 'INSERT INTO address_activity (last_send_datetime, last_delivery_datetime, last_read_datetime, last_click_datetime, address_id, user_id) VALUES (?, ?, ?, ?, ?, ?)' with params [null, null, "2017-05-10 15:52:50", "2017-05-10 15:52:50", null, null]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'address_id' cannot be null"address_id and user_id are the columns that I am referencing:
It is okay that entity is being inserted, but it is not okay that address_id and user_id values are null, while var_dump() showing that they are actually not null:
@Ocramius commented on GitHub (May 10, 2017):
Can you check whether those values are also not
nullwhen reading viareflection?
On 10 May 2017 6:38 p.m., "Sergii Smirnov" notifications@github.com wrote:
@smilesrg commented on GitHub (Jun 30, 2017):
@Ocramius Not a doctrine bug, closing this issue.
@avlima commented on GitHub (May 2, 2018):
Hello @smilesrg , what did you to to fix this? I'm having same issue
@gabrielebarchiesi commented on GitHub (Mar 12, 2021):
I have experienced same issue, UnitOfWork::executeInserts($class) is called instead of nothing. Only for very particular issues, maybe when repository uses useQueryCache(true) and/or useResultCache(true). I changed some logic and now seems to be ok.
@smilesrg commented on GitHub (Jul 19, 2021):
I guess the problem was that I used different entity managers