SHARE
TWEET

ParentRecordType

a guest Dec 3rd, 2018 5 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. namespace App\Form;
  4.  
  5. use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  6. use Symfony\Component\Form\FormBuilderInterface;
  7. use Symfony\Component\OptionsResolver\OptionsResolver;
  8.  
  9. class ParentRecordType extends AbstractType
  10. {
  11.  
  12.     public function buildForm(FormBuilderInterface $builder, array $options)
  13.     {
  14.         $builder->add(
  15.             'children',
  16.             CollectionType::class,
  17.             [
  18.                 'label' => false,
  19.                 'entry_type' => RecordSplitType::class,
  20.                 'allow_add' => true,
  21.                 'allow_delete' => true,
  22.                 'by_reference' => false,
  23.             ]
  24.         );
  25.     }
  26.  
  27.     public function configureOptions(OptionsResolver $resolver)
  28.     {
  29.         $resolver->setDefined('prototype_data');
  30.  
  31.         $resolver->setDefaults(
  32.             [
  33.                 'translation_domain' => 'record',
  34.                 'submit' => true,
  35.             ]
  36.         );
  37.     }
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top