Hi,
Following the docs for Modelless form (cake 3)
I am trying to get the form’s data.
In the normal form, there is getData()
but sadly, it doesn’t work for modelless form. It seems that I can only get the data using $this->request->getData()
My object currently looks like this after post.
object(App\Form\DatetimeForm) {
'_schema' => [
'_fields' => [
'start_datetime' => [
'type' => 'datetime',
'length' => null,
'precision' => null,
'default' => null
],
'end_datetime' => [
'type' => 'datetime',
'length' => null,
'precision' => null,
'default' => null
]
]
],
'_errors' => [],
'_validator' => [
'_presenceMessages' => [],
'_allowEmptyMessages' => [],
'_allowEmptyFlags' => [],
'_useI18n' => true,
'_providers' => [
(int) 0 => 'form'
],
'_fields' => []
],
'_schemaClass' => 'Cake\Form\Schema',
'_data' => [
'start_datetime' => object(Cake\I18n\Time) {
'time' => '2021-02-07 21:00:00.000000+08:00',
'timezone' => 'Asia/Singapore',
'fixedNowTime' => false
},
'end_datetime' => object(Cake\I18n\Time) {
'time' => '2021-02-07 21:00:00.000000+08:00',
'timezone' => 'Asia/Singapore',
'fixedNowTime' => false
}
],
'_eventManager' => object(Cake\Event\EventManager) {
'_listeners' => [
'Form.buildValidator' => '1 listener(s)'
],
'_isGlobal' => false,
'_trackEvents' => false,
'_generalManager' => '(object) EventManager',
'_dispatchedEvents' => null
},
'_eventClass' => 'Cake\Event\Event',
'_validatorClass' => 'Cake\Validation\Validator',
'_validators' => [
'default' => object(Cake\Validation\Validator) {
'_presenceMessages' => [],
'_allowEmptyMessages' => [],
'_allowEmptyFlags' => [],
'_useI18n' => true,
'_providers' => [
(int) 0 => 'form'
],
'_fields' => []
}
]
}