php - CakePHP: How to insert a row into a join table -


i have 2 models/tables have "has , belongs many" (habtm) relationship: qsets , questions

i can delete rows manually follows:

$this->qset->qsetsquestion->deleteall( array("qsetsquestion.qset_id"=>$qset_id, "qsetsquestion.question_id"=>$question_id), false ); 

how can insert new row in join table? documentation find working habtm data refers forms, data isn't coming form.

it's this, think:

$data = array(     [question] => array         (             [id] => $question_id         )     [qset] => array         (             [id] => $qset_id         ) );  $this->question->saveall($data); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -