Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace My\Bundle\Form\Post;
- use Symfony\Component\Form\AbstractType;
- use Symfony\Component\Form\FormBuilderInterface;
- use Symfony\Component\OptionsResolver\OptionsResolverInterface;
- use My\Bundle\Form\Post\GalleryImageType;
- class GalleryType extends AbstractType
- {
- /**
- * @param FormBuilderInterface $builder
- * @param array $options
- */
- public function buildForm(FormBuilderInterface $builder, array $options)
- {
- $builder
- ->add('name')
- ->add('images', 'collection', array(
- 'type' => new GalleryImageType()
- ))
- ;
- }
- /**
- * @param OptionsResolverInterface $resolver
- */
- public function setDefaultOptions(OptionsResolverInterface $resolver)
- {
- $resolver->setDefaults(array(
- 'data_class' => 'My\Bundle\Entity\Post\Gallery'
- ));
- }
- /**
- * @return string
- */
- public function getName()
- {
- return 'post_gallery';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement