Update multiple objects in joined table from the edit template

Hi all.

I’m trying to put together an assessment style app where a user can create a questionnaire based on a selection of questions.

On the ‘assessment’ page, I can list out all the questions the user has selected for the questionnaire. What I would like to do is on the ‘edit’ template for the questionnaire, have a table of questions with an ‘answer’ textbox on the right.

Answers are currently stored in a joined table. I can see variables stored corerctly using the debugger but I am not sure how to proceed from here. In the current example, I have an assessment with 3 questions selected out of 100. I can see the array with the 3 questions. I have injected 1 answer for one of those questions as a quick test and I can see the variable just fine in the debugger.

assessment (array)

id 1
customer_id 1
name Assessment 1
description First test assessment.
created (array)
modified (array)
answers (array)
    0 (Cake\ORM\Entity)
        id 1
        question_id 4
        answer pretend answer text
        assessment_id 1
questions (array)
    0 (App\Model\Entity\Question)
    1 (App\Model\Entity\Question)
    2 (App\Model\Entity\Question)

Can anyone point a newbie in the right direction? I should add that I am mostly baked right out with very few customisations.

Thanks all.

If you have an association configured for the answers property you would be able to save that data with save and the associated option.