Galera blz ...,
I am editing a field to save in db, I send pro edit.ctp the following array
$result = array_merge($cones->toArray(), $cda->toArray());
debug($result);
// Result:
[
(int) 0 => 'Valor 1',
(int) 1 => 'Valor 2',
(int) 2 => 'Valor 3'
]
// edit.ctp
<?php
echo $this->Form->control('name',
[
'empty' => 'Selecione um cone',
'label' => false,
'type' => 'select',
'options' => $result
]);
?>
But when I run to save to the bank it saves the index and not the value of it. Result of $ this- > request- > data;
[
'name' => '0'
]
I'm new to php, tried some things like array_values, and some unsuccessful searches. Thank you in advance.