Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. <?php
  2.  
  3. namespace AppBundle\Form;
  4.  
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\FormBuilderInterface;
  7. use Symfony\Component\OptionsResolver\OptionsResolver;
  8.  
  9. use Symfony\Component\Form\Extension\Core\Type\TextType;
  10. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  11. use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  12.  
  13. class ApplicationType extends AbstractType
  14. {
  15. /**
  16. * @param FormBuilderInterface $builder
  17. * @param array $options
  18. */
  19. public function buildForm(FormBuilder $builder, array $options)
  20. {
  21. $builder
  22. ->add('firstname', TextType::class, array(
  23. 'label'=>'',
  24. 'attr'=>array(
  25. 'class'=>'gui-input',
  26. 'placeholder'=>'',
  27. 'dir'=>'ltr'
  28. )
  29. )
  30. )
  31. ->add('lastname', TextType::class, array(
  32. 'label'=>'',
  33. 'attr'=>array(
  34. 'class'=>'gui-input',
  35. 'placeholder'=>'',
  36. 'dir'=>'ltr'
  37. )
  38. )
  39. )
  40. ->add('skills', CollectionType::class, array(
  41. 'entry_type' => SkillType::class,
  42. 'allow_add' => true, // to allow adding items dynamically
  43. 'allow_delete' => true,
  44.  
  45. 'by_reference' => false,
  46.  
  47. 'prototype' => true,
  48. 'prototype_name'=> 'skill__name__',
  49. )
  50. );
  51. }
  52.  
  53. /**
  54. * @param OptionsResolver $resolver
  55. */
  56. public function configureOptions(OptionsResolver $resolver)
  57. {
  58. $resolver->setDefaults(array(
  59. 'data_class' => 'ModelBundle\Entity\Application'
  60. ));
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement