I have two tables resumes and links. resumes has hasmany relation with links.I want to save many links for single resume.
My $this->request->data array is like
Array
(
[alternate_email] =>
[mobile] => 23232
[level] => Student
[youtube] =>
[links] => Array
(
[0] => Array
(
['link'] => www.google.com
['user_id'] => 1
)
[1] => Array
(
['link'] => abc.com
['user_id'] => 1
)
)
)
$resume = $this->Resumes->newEntity($this->request->data);
if ($this->Resumes->save($resume)) {
// return true;
}
This is working and my data is saved in resumes table properly but in links table data saved like following:
id | resume_id | user_id | link
1 | 1 | |
I want like
id | resume_id | user_id | link
1 | 1 | | www.google.com
resume_id
oruser_id
?debug($resume)
say before and after saving (please update your question with debugging results, don't put them here in the comments)? Any validation errors? Do you have any before save logic implemented? Why don't you want theuser_id
to be saved (as shown in your "I want like" example)?