Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. namespace App\Form\UZForms\Forms;
  5.  
  6. use App\Form\DataTransformer\ApiIdArrayTransformer;
  7. use App\Form\UZForms\DataProviders\General\AdjuntosFormProvider;
  8. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  9. use Symfony\Component\Form\FormBuilderInterface;
  10.  
  11. class AdjuntosChoiceType extends ChoiceType
  12. {
  13.  
  14.  
  15.     /**
  16.      * @var AdjuntosFormProvider
  17.      */
  18.     private $adjuntosFormProvider;
  19.  
  20.     public function __construct(AdjuntosFormProvider $adjuntosFormProvider)
  21.     {
  22.         parent::__construct(null);
  23.  
  24.         $this->adjuntosFormProvider = $adjuntosFormProvider;
  25.     }
  26.  
  27.     public function buildForm(FormBuilderInterface $builder, array $options) {
  28.  
  29.         $options['choices'] = $this->adjuntosFormProvider->getAdjuntos();
  30.         $options['attr']['class'] = 'form-control select2-multiple';
  31.  
  32. //        $builder->addModelTransformer(new ApiIdArrayTransformer('adjuntos'));
  33.  
  34.         parent::buildForm($builder, $options);
  35.     }
  36.  
  37.  
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement