in my CRUD Controller I have a CollectionField which has an entryType option referring to a formType
yield CollectionField::new('drinks', 'Boissons')
->setFormTypeOption('by_reference', false)
->setEntryType(CommandProductItemType::class);
CommandProductItemType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('product', EntityType::class, [
'label' => 'Produit',
'class' => Product::class,
'choice_label' => 'namePrice',
])
->add('quantity', IntegerType::class, [
'label' => 'Quantité',
'attr' => [
'min' => 1
]
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => CommandProductItem::class,
'category' => Category::class
]);
}
How can I pass the category option to the CommandProductItemType from the CollectionField item ?