-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DDC-3377: DateTime columns cannot be used with @Id #4178
Comments
Comment created by cverges-ch: There is a portable workaround where you create a string-based shadow key that gets updated by Doctrine events: DateTimeIdTest.php:
|
Issue was closed with resolution "Duplicate" |
Will this bug fix? |
@peter-gribanov I already marked this as |
@Ocramius Thanks. I noticed, but where is the original issue? Is it only in your Jira? |
@peter-gribanov all issues were copied over and auto-closed: you can search for them by the identifier (for example |
This issue related:
@Ocramius All tasks that i can see is are already closed, but the bug is not resolved. And yet, where can i find out and monitor the status of this bug? |
I'm also looking for a solution. |
@drupol You could look into using Chronos for Date intead of native date types. They have a __toString and that should make this work: https://packagist.org/packages/warhuhn/chronos-doctrine |
Thanks @beberlei, I will give it a try again. |
Dear @beberlei , I tried here: https://github.com/drupol/doctrine-date-as-id/pull/2 but apparently, it's the same issue. |
Please read the error csrefully, your code still has a DateTime object there you need a Chronos instance |
Jira issue originally created by user cverges-ch:
DateTimeIdTest.php:
test.php:
Output:
I was able to debug this down to where the implode() call in Doctrine\ORM\UnitOfWork::addToIdentityMap() is what is triggering this problem. It attempts to convert all contained entities in the Doctrine\ORM\UnitOfWork::entityIdentifiers array to strings. For a DateTime object, the DateTime::format() function should be used instead of relying on **toString().
The text was updated successfully, but these errors were encountered: