0
After completing the form and submitting, returns the following array
:
array(
'User' => array(
'password' => '*****',
'nome' => 'Engenharia',
'username' => '[email protected]',
'confirm_password' => '123',
),
'Endereco' => array(
(int) 0 => array(
'cidade_id' => '3091',
'cep' => '96032012',
'rua' => 'Conde de porto alegre',
'numero' => '420',
'bairro' => 'Porto',
'complemento' => 'Empresa'
)
),
'UserGroup' => array(
'group_id' => '2',
'nome' => 'Cliente'
)
)
Then I receive the following message:
Database Error Error: SQLSTATE[23502]: Not null Violation: 7 ERROR: null value in column "name" violates not-null Constraint. DETAIL: Failing Row contains (87, 2, 180, null).
Notice: If you want to customize this error message, create app/View/Errors/pdo_error.ctp
But I don’t understand where he’s getting this nome == null
, because I’m passing the name of User
and I’m passing the name of UserGroup
also, where I may be missing?
It seems that the error is not here. Something else may be occurring and causing the error.
– Reginaldo Rigo
Yeah, I’ve checked enough, but I’m not finding the problem :|
– Marcos Henzel
I’m saving with
$this->User->saveAssociated($this->request->data);
– Marcos Henzel
Is it possible for you to temporarily remove this Constraint from the seat to see what will be recorded? Maybe seeing what was recorded you’ll find out where this error.
– Reginaldo Rigo
True, I’ll take a look!
– Marcos Henzel
I took the Constraint off the field
nome
tableUserGroup
and saved normally, but with null value of course. Does it conflict with the two tables with fields of the same name ?User => 'nome'
and theUserGroup => 'nome'
– Marcos Henzel
This array is exactly before save? Referring to conflict named after two equal tables, it will depend on your Model...
– Lucas Thibau Paulino
Yes he is before save, I don’t know what happened, but I decided to remove this field from the table of the bank and use the other table that did the same function. Just did one more relationship in the table and searched the values of this new table.
– Marcos Henzel