Guest User

Untitled

a guest
Jan 16th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. <form ...>
  2.  
  3. <ul class="tariffAdjustments ulprototype" data-prototype="{{ protos.tariffAdjustment_prototype(form.tariffAdjustments.vars.prototype)|e('html_attr') }}">
  4. {% for tariffAdjustment in form.tariffAdjustments %}
  5. <li class="eltariffadjustment" data-taid="XXX">
  6. {# can't retrieve the element id #}{{dump(form.tariffAdjustments.vars)}}
  7. {{ protos.tariffAdjustment_prototype(tariffAdjustment)|raw }}
  8. </li>
  9. {% endfor %}
  10. </ul>
  11.  
  12. </form>
  13.  
  14. FormView {#18167
  15. +vars: array:30 [
  16. "value" => PersistentCollection {#9714}
  17. "form" => FormView {#18167}
  18. "id" => "module_entity_tariffAdjustments"
  19. ...
  20. "prototype" => FormView {#18189 ▼
  21. +vars: array:27 [▼
  22. "id" => "module_entity_tariffAdjustments___name__"
  23. ...
  24. ]
  25. +parent: FormView {#18167}
  26. +children: array:10 []
  27. "name" => FormView {#18192} <= entity field exposed in the FormType
  28. "startDate" => FormView {#18197}
  29. ...
  30. -rendered: false
  31. }
  32. ]
  33. +parent: FormView {#8546 ▶}
  34. +children: array:3 [▼
  35. 0 => FormView {#18336 ▼
  36. +vars: array:27 [▼
  37. "value" => TariffAdjustment {#9798 ▼
  38. -id: 154 <= what i'm looking for
  39. ...
  40. }
  41. ...
  42. ]
  43. +parent: FormView {#18167}
  44. +children: array:10 []
  45. -rendered: false
  46. }
  47. 1 => FormView {#18338 ▼
  48. +vars: array:27 [▼
  49. "value" => TariffAdjustment {#9798 ▼
  50. -id: 172 <= what i'm looking for
  51. ...
  52. }
  53. ...
  54. ]
  55. +parent: FormView {#18167}
  56. +children: array:10 []
  57. -rendered: false
  58. }
  59. ]
  60. -rendered: false
  61. }
  62.  
  63. class ModuleType extends AbstractType
  64. {
  65. public function buildForm(FormBuilderInterface $builder, array $options)
  66. {
  67. $em = $options['entity_manager'];
  68. $builder
  69. ->add('tariffAdjustments', CollectionType::class, [
  70. 'label' => 'module.tariffAdjustments',
  71. 'required' => false,
  72. 'attr' => [
  73. 'class' => 'collectiondata',
  74. ],
  75. 'constraints' => new Valid(),
  76. 'entry_type' => TariffAdjustmentType::class,
  77. 'entry_options' => ['entity_manager' => $em],
  78. 'by_reference' => false,
  79. 'allow_add' => true,
  80. 'allow_delete' => true,
  81. ]);
  82. }
  83. }
  84.  
  85. class TariffAdjustmentType extends AbstractType
  86. {
  87.  
  88. public function buildForm(FormBuilderInterface $builder, array $options)
  89. {
  90. $em = $options['entity_manager'];
  91. $builder
  92. ->add('name', TextType::class, [
  93. 'label' => 'name',
  94. 'label_attr' => ['class' => 'mandatory'],
  95. 'required' => true,
  96. ]);
  97. ...
  98. }
  99. }
Add Comment
Please, Sign In to add comment