Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2.  
  3. namespace ReadathonBundle\Form;
  4.  
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\FormBuilderInterface;
  7. use Symfony\Component\OptionsResolver\OptionsResolver;
  8. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  9. use ReadathonBundle\Form\UserType;
  10.  
  11. class StudentType extends AbstractType
  12. {
  13.     /**
  14.      * @param FormBuilderInterface $builder
  15.      * @param array $options
  16.      */
  17.     public function buildForm(FormBuilderInterface $builder, array $options)
  18.     {
  19.         $builder
  20.             ->add('user', UserType::class)
  21.             ->add('schoolClass', EntityType::class, array('class' => 'ReadathonBundle:SchoolClass', 'choice_label' => 'name', 'label' => 'Class', 'property_path' => 'schoolClass'))
  22.         ;
  23.     }
  24.    
  25.     /**
  26.      * @param OptionsResolver $resolver
  27.      */
  28.     public function configureOptions(OptionsResolver $resolver)
  29.     {
  30.         $resolver->setDefaults(array(
  31.             'data_class' => 'ReadathonBundle\Entity\Student'
  32.         ));
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement