In my app, Users
HABTM Solicitations
.
After saving the form using $this->Solicitation->save($this->request->data)
, I need to add another user_id
value in the solicitations_users table.
$data[] = array('User' => array('id' => 5), 'Solicitation' => array('id' => 77));
$data[] = array('User' => array('id' => 6), 'Solicitation' => array('id' => 77));
$this->Solicitation->saveMany($data);
My $data
is this:
array(
'User' => array(
'id' => (int) 6
),
'Solicitation' => array(
'id' => '54'
)
)
I need to save the association in the form and then add the new record above to the solicitations_users
table as well. It's only saving the 6
and not the data from the form. It just saves the form if I delete the second save
.
I realized that in the DB, this is jumping one id
.
This should be 'id' 36 => 5; 'id' 37 => 6
. It looks like that is updating the table.
Here is the query: