DDC-2601: [GH-750] Update to allow casting objects to strings (if possible) for non-composi... #3265

Closed
opened 2026-01-22 14:16:56 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Aug 7, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @doctrinebot:

This issue is created automatically through a Github pull request on behalf of tomsowerby:

Url: https://github.com/doctrine/doctrine2/pull/750

Message:

...te-key id attributes.

Bug discovered when using a table with 2 columns, both being used as a composite primary key.
Columns are:

  • user column linked by foreign key (which, when imported, was not mapped as an @id field)
  • datetime column

Php Datetime class was extended to implement a **toString function (as described here http://stackoverflow.com/a/15085566), but this was not being called because doctrine was not recognising the entity as having a composite primary key (due to the non-datetime user key being joined via foreign key (which may in itself be a bug)).

When adding an extra empty text field as part of the composite key, everything worked, it's just because the only non-joined-column was an object, and it managed to avoid the (implode) code that would have cast it as a string.

This change casts the object, in this case a custom datetime, to a string, if it is not part of a composite key.

Originally created by @doctrinebot on GitHub (Aug 7, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @doctrinebot: This issue is created automatically through a Github pull request on behalf of tomsowerby: Url: https://github.com/doctrine/doctrine2/pull/750 Message: ...te-key id attributes. Bug discovered when using a table with 2 columns, both being used as a composite primary key. Columns are: - user column linked by foreign key (which, when imported, was not mapped as an @id field) - datetime column Php Datetime class was extended to implement a **toString function (as described here http://stackoverflow.com/a/15085566), but this was not being called because doctrine was not recognising the entity as having a composite primary key (due to the non-datetime user key being joined via foreign key (which may in itself be a bug)). When adding an extra empty text field as part of the composite key, everything worked, it's just because the only non-joined-column was an object, and it managed to avoid the (implode) code that would have cast it as a string. This change casts the object, in this case a custom datetime, to a string, if it is not part of a composite key.
admin added the Bug label 2026-01-22 14:16:56 +01:00
admin closed this issue 2026-01-22 14:16:57 +01:00
Author
Owner

@doctrinebot commented on GitHub (Aug 7, 2013):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-750] was closed:
https://github.com/doctrine/doctrine2/pull/750

@doctrinebot commented on GitHub (Aug 7, 2013): Comment created by @doctrinebot: A related Github Pull-Request [GH-750] was closed: https://github.com/doctrine/doctrine2/pull/750
Author
Owner

@doctrinebot commented on GitHub (Aug 8, 2013):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-750] was reopened:
https://github.com/doctrine/doctrine2/pull/750

@doctrinebot commented on GitHub (Aug 8, 2013): Comment created by @doctrinebot: A related Github Pull-Request [GH-750] was reopened: https://github.com/doctrine/doctrine2/pull/750
Author
Owner

@doctrinebot commented on GitHub (Nov 28, 2013):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-750] was closed:
https://github.com/doctrine/doctrine2/pull/750

@doctrinebot commented on GitHub (Nov 28, 2013): Comment created by @doctrinebot: A related Github Pull-Request [GH-750] was closed: https://github.com/doctrine/doctrine2/pull/750
Author
Owner

@doctrinebot commented on GitHub (Dec 13, 2013):

Issue was closed with resolution "Invalid"

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

No dependencies set.

Reference: doctrine/archived-orm#3265