protected function prepareView(FormView $view, FormInterface $form, array $options)
    {
        if (isset($options['choice_loader'])
            && $options['choice_loader'] instanceof DynamicChoiceLoaderInterface) {
            /* @var DynamicChoiceLoaderInterface $loader */
            $loader = $options['choice_loader'];
            $values = $form->getData() instanceof ArrayCollection ? $form->getData()->toArray() : $form->getData();
            $values = \is_object($values) ? [$values] : (array) $values;
            $choiceListView = $this->createChoiceListView($loader->loadChoiceListForView($values, $options['choice_name']), $options);

            $view->vars = array_replace($view->vars, [
                'preferred_choices' => $choiceListView->preferredChoices,
                'choices' => $choiceListView->choices,
            ]);
        }
    }
protected function prepareView(FormView $view, FormInterface $form, array $options)
    {
        if (isset($options['choice_loader'])
            && $options['choice_loader'] instanceof DynamicChoiceLoaderInterface) {
            /* @var DynamicChoiceLoaderInterface $loader */
            $loader = $options['choice_loader'];
            $values = $form->getData() instanceof ArrayCollection ? $form->getData()->toArray() : $form->getData();
            $values = \is_object($values) ? [$values] : (array) $values;
            $choiceListView = $this->createChoiceListView($loader->loadChoiceListForView($values, $options['choice_name']), $options);

            $view->vars = array_replace($view->vars, [
                'preferred_choices' => $choiceListView->preferredChoices,
                'choices' => $choiceListView->choices,
            ]);
        }
    }
protected function prepareView ( FormView $ view , FormInterface $ form , array $ options ) { if ( isset ( $ options [ 'choice_loader' ] ) && $ options [ 'choice_loader' ] instanceof DynamicChoiceLoaderInterface ) { /* @var DynamicChoiceLoaderInterface $loader */ $ loader = $ options [ 'choice_loader' ] ; $ values = $ form -> getData ( ) instanceof ArrayCollection ? $ form -> getData ( ) -> toArray ( ) : $ form -> getData ( ) ; $ values = \ is_object ( $ values ) ? [ $ values ] : ( array ) $ values ; $ choiceListView = $ this -> createChoiceListView ( $ loader -> loadChoiceListForView ( $ values , $ options [ 'choice_name' ] ) , $ options ) ; $ view -> vars = array_replace ( $ view -> vars , [ 'preferred_choices' => $ choiceListView -> preferredChoices , 'choices' => $ choiceListView -> choices , ] ) ; } }
Prepare the view.

@param FormView      $view    The view
@param FormInterface $form    The form
@param array         $options The form options
Prepare the view .