Access data in LiveCollectionType #3134
Unanswered
ThibaultJlvt
asked this question in
Questions & Answers
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm using a LiveCollectionType in a form.
I'm trying to access my data object in my LiveCollectionType ...
I have something like this :
$builder->add('programmes', LiveCollectionType::class, [ 'entry_type' => MyEntityType::class, 'label' => 'Programme(s) :', 'label_html' => true, 'allow_add' => false, 'allow_delete' => false, 'by_reference' => false, 'required' => false, 'entry_options' => [ 'categorie' => $categorie, ], 'data' => $this->programmesTravaux, ])
I would like to know if it's possible to access my "MyEntity" entity inside my LiveCollectionType in the buildForm function with something like :
public function buildForm(FormBuilderInterface $builder, array $options): void { $data = $options['data']; }
Thank you !
Beta Was this translation helpful? Give feedback.
All reactions