# |
Dec 12th 2017, 14:14 |
hmic |
obinoob, you need the data to use the displayfield |
# |
Dec 12th 2017, 14:11 |
saeideng |
i want to open issue for this |
# |
Dec 12th 2017, 14:11 |
saeideng |
can we add a method for this into chronos ? @admad |
# |
Dec 12th 2017, 14:09 |
obinoob |
hmic: any thoughts on setDisplayField() ? |
# |
Dec 12th 2017, 13:49 |
admad |
try: `$yourTime = \DateTime('now', 'your-tz'); $yourTime->setTimestamp($otherTime->format('U'));` |
# |
Dec 12th 2017, 13:47 |
saeideng |
? |
# |
Dec 12th 2017, 13:47 |
saeideng |
by $yourTime = new \Cake\I18n\Time($utcTime->format('Y-m-d H:i:s'), 'your-timezone'); |
# |
Dec 12th 2017, 13:47 |
saeideng |
but how you parse the date/time by different timezone? / and convert into your default timezone in your codes |
# |
Dec 12th 2017, 13:45 |
saeideng |
@admad your code works |
# |
Dec 12th 2017, 13:40 |
saeideng |
there is not a build-in method for it ? |
# |
Dec 12th 2017, 13:40 |
admad |
@saeideng try `$yourTime = new Time($utcTime->format('Y-m-d H:i:s'), 'your-timezone');` |
# |
Dec 12th 2017, 13:40 |
saeideng |
`$time->setTimezone(new \DateTimeZone('UTC'));` this not proper for me in this case |
# |
Dec 12th 2017, 13:39 |
obinoob |
saeideng if you need to work with multiple timezones I would say to go with i18n that's the purpose of it I guess... |
# |
Dec 12th 2017, 13:38 |
saeideng |
I need it for parsing time |
# |
Dec 12th 2017, 13:38 |
neon1024 |
As your mutating the state of the instance |
# |
Dec 12th 2017, 13:37 |
neon1024 |
I wouldn’t do that |
# |
Dec 12th 2017, 13:37 |
saeideng |
in cakephp/chronos or cakephp/i18n |
# |
Dec 12th 2017, 13:36 |
saeideng |
2:50 in UTC => 2:50 in other timezone |
# |
Dec 12th 2017, 13:35 |
saeideng |
for example |
# |
Dec 12th 2017, 13:35 |
saeideng |
how can i change timezone , without changing time |
# |
Dec 12th 2017, 13:34 |
obinoob |
hmic: without having to contain('Users') ... |
# |
Dec 12th 2017, 13:34 |
obinoob |
hmic: see I won't to display the username where user_id https://gist.github.com/obinoob/d0aa6321b650cdc61db67d025f122125#file-proposals-ctp-L67 |
# |
Dec 12th 2017, 13:32 |
hmic |
obinoob, the view is more interesting |
# |
Dec 12th 2017, 13:31 |
obinoob |
hmic: refresh the table link please I've gisted the wrong file :( sorry |
# |
Dec 12th 2017, 13:31 |
jotpe |
@dereuromark yeah, but it's just used this single time, so a method would be a bit overload. |
# |
Dec 12th 2017, 13:30 |
neon1024 |
I’d use a collection instead of Hash::extract |
# |
Dec 12th 2017, 13:30 |
obinoob |
hmic: Well I'm sure it as a reason most probably doing something wrong I guess |
# |
Dec 12th 2017, 13:30 |
dereuromark |
sometimes it just easier to have a method that iterats internally over an array and returns bool result :slightly_smiling_face: |
# |
Dec 12th 2017, 13:29 |
jotpe |
why does this not work? Hash::extract($submissions, '{n}.Submission.[status_id=4]'); |
# |
Dec 12th 2017, 13:29 |
jotpe |
Hey! I want to check if a array contains a specific value with Hash::extract(). The array is 0.Submission.status_id => 4, 1.Submission.status_id => 5... |
# |
Dec 12th 2017, 13:28 |
obinoob |
hmic: not a problem ;) here my Table https://gist.github.com/obinoob/50c326b0a079861d5311d7b89e0ad83b and Controller method https://gist.github.com/obinoob/ceffa14821e7c353f6216fd9b3043539#file-clientscontroller-php-L230 |
# |
Dec 12th 2017, 13:26 |
hmic |
if you e.g. $table->find('list') it will use the primarykey as the key and the displayfield as the value in the corresponding array |
# |
Dec 12th 2017, 13:25 |
hmic |
but yes, it works this way. |
# |
Dec 12th 2017, 13:25 |
hmic |
i have mixed you up with the flash question |
# |
Dec 12th 2017, 13:25 |
hmic |
oh, sorry. |
# |
Dec 12th 2017, 13:25 |
obinoob |
hmic: hold on a bit |
# |
Dec 12th 2017, 13:25 |
obinoob |
upgraded from 3.2 $this->setDisplayField('title'); |
# |
Dec 12th 2017, 13:25 |
hmic |
how does your controller code to set the message and the template code to display it look like? |
# |
Dec 12th 2017, 13:24 |
obinoob |
3.5 |
# |
Dec 12th 2017, 13:24 |
hmic |
obinoob, which cake version? |
# |
Dec 12th 2017, 13:24 |
obinoob |
hmic: Well I had the same ideia even after reading https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html but I can't make it work :( |