public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $choices = array();
     foreach ($this->branchService->getAllbranches() as $branch) {
         $choices[$branch->getId()] = $branch->getName();
     }
     $resolver->setDefaults(array('choices' => $choices));
 }
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $choices = array();
     foreach ($this->branchService->getAllbranches() as $branch) {
         $choices[$branch->getId()] = $branch->getName();
     }
     $brunchForDelete = $options['data']['id'];
     if (isset($choices[$brunchForDelete])) {
         unset($choices[$brunchForDelete]);
     }
     $builder->add($builder->create('newBranch', 'choice', array('label' => 'diamante.desk.branch.messages.delete.select', 'required' => true, 'attr' => array('style' => "width:110px"), 'choices' => $choices)))->add($builder->create('moveTickets', 'checkbox', array('label' => 'diamante.desk.branch.messages.delete.move', 'required' => false)));
 }
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $choices = [];
     foreach ($this->branchService->getAllbranches() as $branch) {
         $choices[$branch->getId()] = $branch->getName();
     }
     if (isset($options['data']['values'])) {
         $removeBranches = explode(',', $options['data']['values']);
         $flipedBranches = array_flip($removeBranches);
         $choices = array_diff_key($choices, $flipedBranches);
     }
     $builder->add($builder->create('newBranch', 'choice', ['label' => 'diamante.desk.branch.messages.delete.select', 'required' => true, 'attr' => ['style' => "width:110px"], 'choices' => $choices]))->add($builder->create('moveMassTickets', 'checkbox', ['label' => 'diamante.desk.branch.messages.delete.move', 'required' => false]))->add($builder->create('removeBranches', 'hidden', ['required' => false, 'data' => $options['data']['values']]));
 }