This is a (multiple allowed):
-
[x] bug
-
[ ] enhancement
-
[ ] feature-discussion (RFC)
-
CakePHP Version: 3.6.10.
-
Platform and Target: wampp server.
What you did
Good morning, I made a form that sends the next data.
[
'crtxtipodocumento_id' => '1',
'numerodocumento' => '111111',
'digito_verificacion' => '1',
'lugar_expedicion' => '123',
'razon_social' => '111111111',
'regimen' => 'SIMPLIFICADO',
'telefono_principal' => '1111111111',
'primer_nombre' => '1111111111',
'otros_nombres' => '1111111111111',
'apellido_paterno' => '11111111111',
'apellido_materno' => '111111111111',
'fecha_nacimiento' => '2018-12-03',
'email' => '1111111',
'email_2' => '11111111111',
'direccion' => '111111111111',
'direccion_correspondencia' => '11111111111111',
'crtxdepartamento_id' => '23',
'crtxciudade_id' => '5038',
'representante_legal' => '111111111',
'tipo_doc_representantelegal' => 'OTRO',
'doc_representantelegal' => '1111111111',
'lugar_exp_doc_representantelegal' => '111111111111',
'crtxtelefonos' => [
(int) 0 => [
'name' => '1111111111',
'tipo' => 'FIJO',
'extension' => ''
],
(int) 1 => [
'name' => '222222222222222',
'tipo' => 'PBX',
'extension' => '22222222222'
]
],
'crtxcuentas' => [
(int) 0 => [
'tipo' => 'AHORROS',
'crtxbanco_id' => '1',
'name' => '111111111'
]
]
]
I am trying to save a person with phones and bank accounts information.
input example
<input type="text" name="crtxtelefonos[0][tipo]">
this inputs are generated with javascript
What happened
It saves when there are not validation errors, but that is not the problem, the problem is that when there are validations errors, it goes back to the view with the next data in the model:
object(App\Model\Entity\Crtxpersona) {
'crtxtipodocumento_id' => (int) 1,
'numerodocumento' => (int) 111111,
'digito_verificacion' => (int) 1,
'lugar_expedicion' => '123',
'razon_social' => '111111111',
'regimen' => 'SIMPLIFICADO',
'telefono_principal' => (int) 1111111111,
'primer_nombre' => '1111111111',
'otros_nombres' => '1111111111111',
'apellido_paterno' => '11111111111',
'apellido_materno' => '111111111111',
'fecha_nacimiento' => object(Cake\I18n\FrozenDate) {
'time' => '2018-12-03T00:00:00+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false
},
'email_2' => '11111111111',
'direccion' => '111111111111',
'direccion_correspondencia' => '11111111111111',
'crtxdepartamento_id' => (int) 23,
'crtxciudade_id' => (int) 5038,
'representante_legal' => '111111111',
'tipo_doc_representantelegal' => 'OTRO',
'doc_representantelegal' => '1111111111',
'lugar_exp_doc_representantelegal' => '111111111111',
'crtxtelefonos' => [
(int) 0 => object(App\Model\Entity\Crtxtelefono) {
'name' => '1111111111',
'tipo' => 'FIJO',
'extension' => '',
'createdby' => (int) 1,
'deleted' => false,
'created' => object(Cake\I18n\FrozenTime) {
'time' => '2018-12-12T20:40:39+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false
},
'[new]' => true,
'[accessible]' => [
'crtxpersona_id' => true,
'name' => true,
'tipo' => true,
'extension' => true,
'created' => true,
'createdby' => true,
'modified' => true,
'modifiedby' => true,
'deleted' => true,
'crtxpersona' => true
],
'[dirty]' => [
'name' => true,
'tipo' => true,
'extension' => true,
'createdby' => true,
'deleted' => true,
'created' => true
],
'[original]' => [],
'[virtual]' => [],
'[errors]' => [],
'[invalid]' => [],
'[repository]' => 'Crtxtelefonos'
},
(int) 1 => object(App\Model\Entity\Crtxtelefono) {
'name' => '222222222222222',
'tipo' => 'PBX',
'extension' => '22222222222',
'createdby' => (int) 1,
'deleted' => false,
'created' => object(Cake\I18n\FrozenTime) {
'time' => '2018-12-12T20:40:39+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false
},
'[new]' => true,
'[accessible]' => [
'crtxpersona_id' => true,
'name' => true,
'tipo' => true,
'extension' => true,
'created' => true,
'createdby' => true,
'modified' => true,
'modifiedby' => true,
'deleted' => true,
'crtxpersona' => true
],
'[dirty]' => [
'name' => true,
'tipo' => true,
'extension' => true,
'createdby' => true,
'deleted' => true,
'created' => true
],
'[original]' => [],
'[virtual]' => [],
'[errors]' => [],
'[invalid]' => [],
'[repository]' => 'Crtxtelefonos'
}
],
'crtxcuentas' => [
(int) 0 => object(Cake\ORM\Entity) {
'tipo' => 'AHORROS',
'crtxbanco_id' => (int) 1,
'name' => '111111111',
'createdby' => (int) 1,
'deleted' => false,
'created' => object(Cake\I18n\FrozenTime) {
'time' => '2018-12-12T20:40:39+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false
},
'[new]' => true,
'[accessible]' => [
'*' => true
],
'[dirty]' => [
'tipo' => true,
'crtxbanco_id' => true,
'name' => true,
'createdby' => true,
'deleted' => true,
'created' => true
],
'[original]' => [],
'[virtual]' => [],
'[errors]' => [],
'[invalid]' => [],
'[repository]' => 'Crtxcuentas'
}
],
'createdby' => (int) 1,
'deleted' => false,
'[new]' => true,
'[accessible]' => [
'crtxtipodocumento_id' => true,
'crtxdepartamento_id' => true,
'crtxciudade_id' => true,
'numerodocumento' => true,
'digito_verificacion' => true,
'apellido_paterno' => true,
'apellido_materno' => true,
'primer_nombre' => true,
'otros_nombres' => true,
'nombres_completos' => true,
'razon_social' => true,
'direccion' => true,
'telefono_principal' => true,
'email' => true,
'email_2' => true,
'lugar_expedicion' => true,
'direccion_correspondencia' => true,
'regimen' => true,
'fecha_nacimiento' => true,
'copropiedad' => true,
'contratista' => true,
'inmobiliaria' => true,
'aseguradora' => true,
'representante_legal' => true,
'tipo_doc_representantelegal' => true,
'doc_representantelegal' => true,
'lugar_exp_doc_representantelegal' => true,
'created' => true,
'createdby' => true,
'modified' => true,
'modifiedby' => true,
'deleted' => true,
'crtxtipodocumento' => true,
'crtxdepartamento' => true,
'crtxciudade' => true,
'crtxcontratopersonas' => true,
'crtxcopropiedades' => true,
'crtxcuentainmuebles' => true,
'crtxcuentas' => true,
'crtxpqrs' => true,
'crtxreparacionesgenerales' => true,
'crtxsolicitudarrendamientos' => true,
'crtxtelefonos' => true
],
'[dirty]' => [
'crtxtipodocumento_id' => true,
'numerodocumento' => true,
'digito_verificacion' => true,
'lugar_expedicion' => true,
'razon_social' => true,
'regimen' => true,
'telefono_principal' => true,
'primer_nombre' => true,
'otros_nombres' => true,
'apellido_paterno' => true,
'apellido_materno' => true,
'fecha_nacimiento' => true,
'email_2' => true,
'direccion' => true,
'direccion_correspondencia' => true,
'crtxdepartamento_id' => true,
'crtxciudade_id' => true,
'representante_legal' => true,
'tipo_doc_representantelegal' => true,
'doc_representantelegal' => true,
'lugar_exp_doc_representantelegal' => true,
'crtxtelefonos' => true,
'crtxcuentas' => true,
'createdby' => true,
'deleted' => true
],
'[original]' => [],
'[virtual]' => [],
'[errors]' => [
'email' => [
'email' => 'The provided value is invalid'
]
],
'[invalid]' => [
'email' => '1111111'
],
'[repository]' => 'Crtxpersonas'
}
As you can see the associations data is in there and when it tries to put it back in the view, it gives me the next error:
Notice (8): Array to string conversion [CORE\src\View\Helper\FormHelper.php, line 1759]
Notice (8): Array to string conversion [CORE\src\View\StringTemplate.php, line 311]
I did unset the associations data from the model, but the problem keeps happening.
How can I fix it? It does not matter if the associations data does not goes back to the view.
Thanks.