Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace ReadathonBundle\Form;
- use Symfony\Component\Form\AbstractType;
- use Symfony\Component\Form\FormBuilderInterface;
- use Symfony\Component\OptionsResolver\OptionsResolver;
- use Symfony\Bridge\Doctrine\Form\Type\EntityType;
- use ReadathonBundle\Form\UserType;
- class StudentType extends AbstractType
- {
- /**
- * @param FormBuilderInterface $builder
- * @param array $options
- */
- public function buildForm(FormBuilderInterface $builder, array $options)
- {
- $builder
- ->add('user', UserType::class)
- ->add('schoolClass', EntityType::class, array('class' => 'ReadathonBundle:SchoolClass', 'choice_label' => 'name', 'label' => 'Class', 'property_path' => 'schoolClass'))
- ;
- }
- /**
- * @param OptionsResolver $resolver
- */
- public function configureOptions(OptionsResolver $resolver)
- {
- $resolver->setDefaults(array(
- 'data_class' => 'ReadathonBundle\Entity\Student'
- ));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement