# |
May 31st 2016, 09:44 |
Neon1024 |
Unless it doesnâ??t |
# |
May 31st 2016, 09:44 |
Neon1024 |
Sorry, it works fine for me |
# |
May 31st 2016, 09:40 |
birdy247 |
so so difficult to achieve something that seems so so easy lol |
# |
May 31st 2016, 09:40 |
birdy247 |
face palm |
# |
May 31st 2016, 09:40 |
birdy247 |
Neon1024 the problem with that is it then doesnt return a datetime object when i do a find() |
# |
May 31st 2016, 09:33 |
unorthodox |
:) |
# |
May 31st 2016, 09:32 |
Neon1024 |
p |
# |
May 31st 2016, 09:32 |
Neon1024 |
https://github.com/davidyell/CakePHP3-Proffer/blob/master/src/Database/Type/FileType.php |
# |
May 31st 2016, 09:32 |
Neon1024 |
Check out my super complex data type class |
# |
May 31st 2016, 09:32 |
Neon1024 |
Just do that, but in a data type class |
# |
May 31st 2016, 09:29 |
birdy247 |
and stop cake doing any marshalling of datetime for me and I do it in the entity myself using createFromFormat |
# |
May 31st 2016, 09:28 |
birdy247 |
unless I make a "plain" data type |
# |
May 31st 2016, 09:28 |
birdy247 |
my previous way of solving it doesnt work |
# |
May 31st 2016, 09:28 |
birdy247 |
the annoying part is I go through this every time I start a new cake project on a higher version :slightly_smiling_face: |
# |
May 31st 2016, 09:21 |
birdy247 |
https://gist.github.com/birdy247/f6305db312419420c2f94ecd58046f72 |
# |
May 31st 2016, 09:19 |
Neon1024 |
Iâ??ve not looked at it in this degree of detail since 2016-02-10 |
# |
May 31st 2016, 09:19 |
Neon1024 |
From what I remember |
# |
May 31st 2016, 09:18 |
Neon1024 |
Yes, so I can have in my CMS set a datetime in BST and itâ??ll save in UTC, and I can load a UTC from the db and marshall to local timezone |
# |
May 31st 2016, 09:18 |
birdy247 |
so with your script Neon1024, should it basiclaly override the cake stuff, and instead create with the local timezone and then convert to UTC |
# |
May 31st 2016, 09:18 |
storkovo |
birdy247: that snippet didnâ??t make it to the irc channel |
# |
May 31st 2016, 09:17 |
birdy247 |
cake has already converted my string into a datetime object |
# |
May 31st 2016, 09:17 |
birdy247 |
the easiest way I can see |
# |
May 31st 2016, 09:16 |
unorthodox |
How i can retrieve entity's id on beforeMarshal? |
# |
May 31st 2016, 09:15 |
birdy247 |
can you see that on IRC? |
# |
May 31st 2016, 09:14 |
Neon1024 |
I just have the 1 project where I need to do it really |
# |
May 31st 2016, 09:13 |
Neon1024 |
Hopefully something can be implemented in Chronos or CakePHP to deal with it in a concise and elegant way |
# |
May 31st 2016, 09:13 |
Neon1024 |
Perhaps have a look for an issue in Github, as youâ??re not alone trying to solve this problem |
# |
May 31st 2016, 09:13 |
Neon1024 |
I like the data type class though as it feels a logical fit |
# |
May 31st 2016, 09:12 |
birdy247 |
and have done on every other project |
# |
May 31st 2016, 09:12 |
birdy247 |
this is what I want to do :slightly_smiling_face: |
# |
May 31st 2016, 09:12 |
Neon1024 |
The suggestion at Cakefest was to store in UTC and write your own helper for front-end |
# |
May 31st 2016, 09:12 |
birdy247 |
I am clearly doing something wrong |
# |
May 31st 2016, 09:12 |
birdy247 |
this is my 3rd cake project where I have had to handle it differently! |
# |
May 31st 2016, 09:12 |
Neon1024 |
If all else fails, which it shouldnâ??t really, you can use good old PHP DateTime to do the same thing |
# |
May 31st 2016, 09:11 |
Neon1024 |
Take a look in Chronos then, might just be a different method name |
# |
May 31st 2016, 09:11 |
birdy247 |
but since upgrading, to 3.2. it doesnt work anymore |
# |
May 31st 2016, 09:11 |
birdy247 |
handled DST |
# |
May 31st 2016, 09:11 |
birdy247 |
it worked fine |
# |
May 31st 2016, 09:11 |
Neon1024 |
It was raised at Cakefest |
# |
May 31st 2016, 09:11 |
birdy247 |
$timeObject = new Time; $time = $timeObject->createFromFormat('d-m-Y H:i', $date, 'Europe/London')->setTimezone('UTC'); return $time; |
# |
May 31st 2016, 09:11 |
birdy247 |
I used to do this is the entity |