Symfony form builder help

Hello. In Symfony I need to create a form with text fields that would hold data pulled from the database for editing. At the moment I have this code:

$question = $this->getDoctrine()->getRepository('QuizBundle:Question')->findOneByIdJoinedToCategory($id);
$data = $question->getAnswers();

Using a query I am getting a question record from the DB. Using the question I am getting the answers for the question which are stored in an Array Collection.
At the moment I can build the form with the question data, but how can I use the answers from the Array Collection to build text fields with the data?
I can also convert the array collection to a regular array, if so how to build text fields with data from a regular array?
Thanks

Form Builder:

$form = $this->createFormBuilder($question)
            ->add('Image', TextType::class)
            ->add('Question', TextType::class)

answers data should go here

            ->add('Submit',SubmitType::class, array('label' => 'Edit Record'))
            ->getForm();

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.