can DateTime objects turn to string in query results? #5308

Closed
opened 2026-01-22 15:04:04 +01:00 by admin · 4 comments
Owner

Originally created by @akmumu on GitHub (Oct 27, 2016).

Originally assigned to: @Ocramius on GitHub.

sometimes i don not need the DateTime obj,but only need the string to display

Originally created by @akmumu on GitHub (Oct 27, 2016). Originally assigned to: @Ocramius on GitHub. sometimes i don not need the DateTime obj,but only need the string to display
admin added the Invalid label 2026-01-22 15:04:04 +01:00
admin closed this issue 2026-01-22 15:04:05 +01:00
Author
Owner

@Ocramius commented on GitHub (Oct 27, 2016):

array_map() over the results and replace the DateTime instances with string via DateTime#format()

@Ocramius commented on GitHub (Oct 27, 2016): `array_map()` over the results and replace the `DateTime` instances with `string` via `DateTime#format()`
Author
Owner

@akmumu commented on GitHub (Oct 27, 2016):

i known this way,bug do not want to array_map every,and thanks a lot

@akmumu commented on GitHub (Oct 27, 2016): i known this way,bug do not want to array_map every,and thanks a lot
Author
Owner

@Ocramius commented on GitHub (Oct 27, 2016):

Doctrine would have to do it for you with some complicated contraption,
while the operation itself takes 3 CLOC: just do it

On 27 Oct 2016 08:36, "Qinglong Zhang" notifications@github.com wrote:

i known this way,bug do not want to array_map every,and thanks a lot


You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/6105#issuecomment-256558842,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakOc6-NvPNHLWyFOVhs8dkroWYFS6ks5q4EZ2gaJpZM4Kh94n
.

@Ocramius commented on GitHub (Oct 27, 2016): Doctrine would have to do it for you with some complicated contraption, while the operation itself takes 3 CLOC: just do it On 27 Oct 2016 08:36, "Qinglong Zhang" notifications@github.com wrote: i known this way,bug do not want to array_map every,and thanks a lot — You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/doctrine/doctrine2/issues/6105#issuecomment-256558842, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakOc6-NvPNHLWyFOVhs8dkroWYFS6ks5q4EZ2gaJpZM4Kh94n .
Author
Owner

@akmumu commented on GitHub (Oct 28, 2016):

ok,thanks

@akmumu commented on GitHub (Oct 28, 2016): ok,thanks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5308