add ability to disable choice in form

Example:
--------------------------------------------------------------------------------------------------------------------------------
   
private $choiceList;

    public function __construct(EntityChoiceList $choiceList = null)
    {
        $this->choiceList = $choiceList;
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $options = array(
            'class' => 'AcmeDemoBundle:Category',
            'required' => true,
        );

        if ($this->choiceList) {
            $options['choice_list'] = $this->choiceList;
        }

        $builder->add('category', 'entity', $options);
      
    }

    public function finishView(FormView $view, FormInterface $form, array $options)
    {
       $ids = $this->getEmptyCategoryIds();

        foreach ($view->children['category']->vars['choices'] as $category) {
            if (in_array($category->value, $ids, true)) {
                $category->disabled = true;
            }
        }
    }

    private function getEmptyCategoryIds()
    {
        return ['2', '4'];
    }