UnitOfWork->createEntity: idHash-creation from DateTime fails #6563

Open
opened 2026-01-22 15:35:01 +01:00 by admin · 0 comments
Owner

Originally created by @roelfsche on GitHub (Oct 28, 2020).

I use a legacy data model, which has a compound primary key, made of a string and a datetime column.
If I try to fetch data as objects, I get an exception

In UnitOfWork.php line 2625:
[ErrorException]
Catchable Fatal Error: Object of class DateTime could not be converted to string

The reason is:
$idHash = implode(' ', $id);

and $id = [ 'date' => DateTime, 'myOtherString' => ....]

May be, the "flattenIdentifier" method should recognize DateTime-Fields and cast them to strings?
Thank you.

Originally created by @roelfsche on GitHub (Oct 28, 2020). I use a legacy data model, which has a compound primary key, made of a string and a datetime column. If I try to fetch data as objects, I get an exception In UnitOfWork.php line 2625: [ErrorException] Catchable Fatal Error: Object of class DateTime could not be converted to string The reason is: `$idHash = implode(' ', $id);` and `$id = [ 'date' => DateTime, 'myOtherString' => ....]` May be, the "flattenIdentifier" method should recognize DateTime-Fields and cast them to strings? Thank you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6563