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

Closed
opened 2026-01-22 14:19:56 +01:00 by admin · 3 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:56 +01:00
admin closed this issue 2026-01-22 14:19:58 +01:00
Author
Owner

@doctrinebot commented on GitHub (Oct 18, 2013):

Comment created by frederes:

My entity class definition

@doctrinebot commented on GitHub (Oct 18, 2013): Comment created by frederes: My entity class definition
Author
Owner

@doctrinebot commented on GitHub (Oct 18, 2013):

Comment created by @ocramius:

Duplicate of DDC-1780 DDC-2724

@doctrinebot commented on GitHub (Oct 18, 2013): Comment created by @ocramius: Duplicate of [DDC-1780](http://www.doctrine-project.org/jira/browse/DDC-1780) [DDC-2724](http://www.doctrine-project.org/jira/browse/DDC-2724)
Author
Owner

@doctrinebot commented on GitHub (Oct 18, 2013):

Issue was closed with resolution "Duplicate"

@doctrinebot commented on GitHub (Oct 18, 2013): Issue was closed with resolution "Duplicate"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3441