0
I have a table on Users
HABTM Solicitations
.
After saving my request, I want to include a new data in the table solicitations_users
if($this->request->is('post')) {
$this->Solicitation->save($this->request->data);
// Aqui é meu codigo onde pego a ID do usuário, 6 por exemplo
// Agora eu quero salvar a User ID na "Solicitation" que acabei de criar.
// O codigo abaixo nao funciona
$data = array($this->data['User']['id'] => 6);
$this->Solicitation->save($data);
How to save a new user_id
on the table associations_users
after the $this->save()
associated with solicitation
that I just created?
Vlw
first question is "the uqe you want to save?"
– Erlon Charles
edited my question. vlw
– Igor Martins
could you explain the context by which you have an update to the record you just created? Wouldn’t it be simpler to pass the Id in the registry that was included? What happens when you run your code? gives some error or does not save any record?
– Tafarel Chicotti