Пример #1
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $code_country = $this->code_country;
     $builder->add('firstname')->add('lastname')->add('gender', 'choice', array('expanded' => true, 'choices' => array('M' => 'm', 'F' => 'f')))->add('mobile')->add('email');
     if ($this->user->isNationalBoardMember() || ($this->type = "SCV")) {
         $builder->add('section', null, array('expanded' => false, 'property' => 'name', 'query_builder' => function (EntityRepository $er) use($code_country) {
             return $er->getSectionsByCountry($code_country);
         }));
     }
     if ($this->type != "committee") {
         $level = $this->user->isNationalBoardMember() || $this->user->isNationalSCV() ? "National" : "Local";
         $builder->add('posts', null, array('expanded' => true, 'property' => 'fullname', 'query_builder' => function (EntityRepository $er) use($level) {
             return $er->findByLevel($level);
         }));
     }
 }