Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form ...>
- <ul class="tariffAdjustments ulprototype" data-prototype="{{ protos.tariffAdjustment_prototype(form.tariffAdjustments.vars.prototype)|e('html_attr') }}">
- {% for tariffAdjustment in form.tariffAdjustments %}
- <li class="eltariffadjustment" data-taid="XXX">
- {# can't retrieve the element id #}{{dump(form.tariffAdjustments.vars)}}
- {{ protos.tariffAdjustment_prototype(tariffAdjustment)|raw }}
- </li>
- {% endfor %}
- </ul>
- </form>
- FormView {#18167
- +vars: array:30 [
- "value" => PersistentCollection {#9714}
- "form" => FormView {#18167}
- "id" => "module_entity_tariffAdjustments"
- ...
- "prototype" => FormView {#18189 ▼
- +vars: array:27 [▼
- "id" => "module_entity_tariffAdjustments___name__"
- ...
- ]
- +parent: FormView {#18167}
- +children: array:10 []
- "name" => FormView {#18192} <= entity field exposed in the FormType
- "startDate" => FormView {#18197}
- ...
- -rendered: false
- }
- ]
- +parent: FormView {#8546 ▶}
- +children: array:3 [▼
- 0 => FormView {#18336 ▼
- +vars: array:27 [▼
- "value" => TariffAdjustment {#9798 ▼
- -id: 154 <= what i'm looking for
- ...
- }
- ...
- ]
- +parent: FormView {#18167}
- +children: array:10 []
- -rendered: false
- }
- 1 => FormView {#18338 ▼
- +vars: array:27 [▼
- "value" => TariffAdjustment {#9798 ▼
- -id: 172 <= what i'm looking for
- ...
- }
- ...
- ]
- +parent: FormView {#18167}
- +children: array:10 []
- -rendered: false
- }
- ]
- -rendered: false
- }
- class ModuleType extends AbstractType
- {
- public function buildForm(FormBuilderInterface $builder, array $options)
- {
- $em = $options['entity_manager'];
- $builder
- ->add('tariffAdjustments', CollectionType::class, [
- 'label' => 'module.tariffAdjustments',
- 'required' => false,
- 'attr' => [
- 'class' => 'collectiondata',
- ],
- 'constraints' => new Valid(),
- 'entry_type' => TariffAdjustmentType::class,
- 'entry_options' => ['entity_manager' => $em],
- 'by_reference' => false,
- 'allow_add' => true,
- 'allow_delete' => true,
- ]);
- }
- }
- class TariffAdjustmentType extends AbstractType
- {
- public function buildForm(FormBuilderInterface $builder, array $options)
- {
- $em = $options['entity_manager'];
- $builder
- ->add('name', TextType::class, [
- 'label' => 'name',
- 'label_attr' => ['class' => 'mandatory'],
- 'required' => true,
- ]);
- ...
- }
- }
Add Comment
Please, Sign In to add comment