getToken()->getUser() instanceof User) { throw new \RuntimeException("you should have a valid user"); } $this->user = $tokenStorage->getToken()->getUser(); $this->authorizationHelper = $authorizationHelper; $this->om = $om; $this->translatableStringHelper = $translatableStringHelper; } /** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('date', 'date', array( 'required' => true, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy') ) ->add('durationTime') ->add('remark', 'textarea', array( 'required' => false, 'empty_data' => '' )) ->add('attendee', 'choice', array( 'expanded' => true, 'required' => false, 'choices' => array( true => 'present', false => 'not present' ) )) ->add('user') //->add('scope') //->add('reason') //->add('type') //->add('person') ; $this->appendScopeChoices($builder, $options['role'], $options['center'], $this->user, $this->authorizationHelper, $this->translatableStringHelper, $this->om); } /** * @param OptionsResolverInterface $resolver */ public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'Chill\ActivityBundle\Entity\Activity' )); $this->appendScopeChoicesOptions($resolver); } /** * @return string */ public function getName() { return 'chill_activitybundle_activity'; } }