Ejemplo n.º 1
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->add('name', 'text', array('label' => 'poi.field.name', 'attr' => array('title' => 'form.field.title.not_blank'), 'constraints' => array(new NotBlank(array('message' => 'field.not_blank')))));
     $builder->add('department', 'text', array('required' => false, 'label' => 'poi.field.department'));
     $builder->add('telephone', 'telephoneType', array('required' => false, 'label' => 'poi.field.telephone'));
     $builder->add('keywords', 'entity', array('required' => false, 'class' => 'Tixi\\CoreDomain\\POIKeyword', 'property' => 'name', 'label' => 'poi.field.keyword', 'multiple' => true, 'expanded' => true, 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('k')->where('k.isDeleted = 0')->orderBy('k.name', 'ASC');
     }));
     $builder->add('address', 'addresslookahead', array('label' => 'address.field.lookahead'));
     $builder->add('comment', 'textarea', array('required' => false, 'label' => 'poi.field.comment'));
     if ($this->user->hasRole('ROLE_MANAGER')) {
         $builder->add('details', 'textarea', array('required' => false, 'label' => 'poi.field.details'));
     }
 }
Ejemplo n.º 2
0
 /**
  * @param $menuId
  * @param User $user
  */
 public function __construct($menuId, User $user)
 {
     parent::__construct($menuId);
     $this->user = $user;
 }