-
Notifications
You must be signed in to change notification settings - Fork 47
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
Datetime format on export/API #403
Comments
Related: #394 |
Regarding API, changing |
HI there, |
Yes probably, but I think that's a bit to much work to involve another persistence. I think it's not yet documented, but now we have this:
|
This is supposed as proposal to fix atk4/data#403 going with the solution @DarkSide666 proposed. This change routs all GET requests (single record and multiple record as well) through exportModel() function, with uses Model->export() while typecasting set to false. This way, date, time and datetime fields are not cast into PHP \DateTime objects, but the values are returned as stored in Persistence. The solution posted here works for the mentioned date/time fields, however I see some problems: 1) what about fields that should get casting? In the end, API should return usable values. E.g about type money? API should return them as formatted to display 2 digits after the dot, shouldnt it? Is this still done? 2) getting a single record should throw an Exception when the requested record is not found. For that, it has to be loaded(). export() in exportModel() loads again, causing an unneccessary DB request.
@PhilippGrashoff please check if fixed, I belive if you export as DB/unmanaged values, all values are casted correctly |
Hi,
as just discussed in the weekly meeting, the ATK API shouldn't export Date, DateTime and Time fields as serialized \DateTime objects, but as strings like (php spreaking):
Datetime: ISO 8601
Date: YYYY-mm-dd
Time: HH:ii:ss
The question open is: Should this be the case on API level only, or deeper in ATK like in export() function itself?
The text was updated successfully, but these errors were encountered: