Hi,
I have been tinkering with Cake 4 and I’m having trouble saving a time field. I have a table with start_time and end_time columns with datatype TIME. The form helper recognizes them but when I try to save it the data will not save.
Post Data:
[
‘event_id’ => ‘2’,
‘other_event’ => ‘’,
‘location_id’ => ‘2’,
‘start_date’ => ‘2020-12-31’,
‘start_time’ => ‘09:00’,
‘end_date’ => ‘2020-12-31’,
‘end_time’ => ‘10:00’,
‘slots’ => ‘123’
]
Patched Entity:
object(App\Model\Entity\Logbook) {
'event_id' => (int) 2,
'other_event' => '',
'location_id' => (int) 2,
'start_date' => object(Cake\I18n\FrozenDate) {
'time' => '2020-12-31 00:00:00.000000+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false
},
'end_date' => object(Cake\I18n\FrozenDate) {
'time' => '2020-12-31 00:00:00.000000+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false
},
'slots' => (int) 123,
'[new]' => true,
'[accessible]' => [
'event_id' => true,
'other_event' => true,
'location_id' => true,
'start_date' => true,
'start_time' => true,
'end_date' => true,
'end_time' => true,
'slots' => true,
'created' => true,
'modified' => true,
'event' => true,
'location' => true,
'participants' => true
],
'[dirty]' => [
'event_id' => true,
'other_event' => true,
'location_id' => true,
'start_date' => true,
'end_date' => true,
'slots' => true
],
'[original]' => [],
'[virtual]' => [],
'[hasErrors]' => false,
'[errors]' => [],
'[invalid]' => [],
'[repository]' => 'Logbooks'
}
When patching, the start_time and end_time are no longer there. Is there a particular way of handling time fields in cakephp 4? I did not have this issue when using 3.8. Any thoughts?
Thanks!