DDC-2749: Error creating Hash in UnitOfWork::addToIdentityMap when composite key contains \DateTime object #3439

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

Originally created by @doctrinebot on GitHub (Oct 18, 2013).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user frederes:

I have an Entity with a composite key that includes a \DateTime object.
When persisting my entity i have this error :
[Symfony\Component\Debug\Exception\ContextErrorException]
Catchable Fatal Error: Object of class DateTime could not be converted to string in ..\Symfony\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php line 1345

Problem is due to \DateTime object not having a **toString() equivalent. In such case, testing if \DateTime and creating a timestamp from this \DateTime may solve this ?

Originally created by @doctrinebot on GitHub (Oct 18, 2013). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user frederes: I have an Entity with a composite key that includes a \DateTime object. When persisting my entity i have this error : [Symfony\Component\Debug\Exception\ContextErrorException] Catchable Fatal Error: Object of class DateTime could not be converted to string in ..\Symfony\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php line 1345 Problem is due to \DateTime object not having a **toString() equivalent. In such case, testing if \DateTime and creating a timestamp from this \DateTime may solve this ?
admin added the Bug label 2026-01-22 14:19:53 +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#3439