i have a collection type:
->add('tipi', CollectionType::class, array(
'entry_type' => TipiType::class,
'allow_add' => true,
'prototype' => true,
'mapped' => false,
'entry_options' => array(
'required' => true,
'label' => false,
)
))
Extend this formtype:
->add('tipi', EntityType::class, array(
'label' => 'Tipo',
'class' => 'AppBundle:Tipi',
'attr' => array('class' => 'form-control'),
'query_builder' => function (EntityRepository $er) {
return $er->createQueryBuilder('t')
->innerJoin('t.requests', 'r')
;
},
));
In the first form type i have an options sended from controller in this way:
$idRequest = $request->get('id');
$form = $this->createForm(RequestsType::class, $requests, array(
'id_request' => $idRequest
));
In the first I can use it, but in the child FormType not. I would passing this variable in the collection type. How can I do that?
$form = $this->createForm(new YourForm($options), $class);