Command/ImportPeopleFromCSVCommand.php
private function collectChoicesAnswers($choices)
    {
        $answers = array();
        
        /* @var $choice \Symfony\Component\Form\ChoiceList\View\ChoiceView */
        foreach($choices as $choice) {
            if ($choice instanceof \Symfony\Component\Form\ChoiceList\View\ChoiceView) {
                $answers[$choice->value] = $choice->label;
            } elseif ($choice instanceof \Symfony\Component\Form\ChoiceList\View\ChoiceGroupView) {
                $answers = $answers + $this->collectChoicesAnswers($choice->choices);
            } else {
                throw new \Exception(sprintf(
                        "The choice type is not know. Expected '%s' or '%s', get '%s'",
                        \Symfony\Component\Form\ChoiceList\View\ChoiceView::class,
                        \Symfony\Component\Form\ChoiceList\View\ChoiceGroupView::class,
                        get_class($choice)
                        ));
            }
        }
        
        return $answers;
    }
private function collectChoicesAnswers($choices)
    {
        $answers = array();
        
        /* @var $choice \Symfony\Component\Form\ChoiceList\View\ChoiceView */
        foreach($choices as $choice) {
            if ($choice instanceof \Symfony\Component\Form\ChoiceList\View\ChoiceView) {
                $answers[$choice->value] = $choice->label;
            } elseif ($choice instanceof \Symfony\Component\Form\ChoiceList\View\ChoiceGroupView) {
                $answers = $answers + $this->collectChoicesAnswers($choice->choices);
            } else {
                throw new \Exception(sprintf(
                        "The choice type is not know. Expected '%s' or '%s', get '%s'",
                        \Symfony\Component\Form\ChoiceList\View\ChoiceView::class,
                        \Symfony\Component\Form\ChoiceList\View\ChoiceGroupView::class,
                        get_class($choice)
                        ));
            }
        }
        
        return $answers;
    }
Recursive method to collect the possibles answer from a ChoiceType (or
its inherited types).

@param \Symfony\Component\Form\FormInterface $form
@return array where