src/Form/Abo/AdressMutationType.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Form\Abo;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  5. use Symfony\Component\Form\Extension\Core\Type\DateType;
  6. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextType;
  9. use Symfony\Component\Form\FormBuilderInterface;
  10. use Symfony\Component\Routing\RouterInterface;
  11. use Symfony\Component\Validator\Constraints\Email;
  12. use Symfony\Component\Validator\Constraints\Length;
  13. use Symfony\Component\Validator\Constraints\NotBlank;
  14. class AdressMutationType extends AbstractType
  15. {
  16. public function __construct(private readonly RouterInterface $router)
  17. {
  18. }
  19. #[\Override]
  20. public function buildForm(FormBuilderInterface $builder, array $options): void
  21. {
  22. $builder
  23. ->add('datumAb', DateType::class,
  24. [
  25. 'label' => 'Ab',
  26. 'required' => true,
  27. 'widget' => 'single_text',
  28. 'constraints' => [
  29. new NotBlank(),
  30. ],
  31. 'html5' => false,
  32. 'format' => 'dd.MM.yyyy',
  33. ]
  34. )
  35. ;
  36. $builder
  37. ->add('vorname', TextType::class,
  38. [
  39. 'required' => true,
  40. 'attr' => ['maxlength' => 100],
  41. 'constraints' => [
  42. new NotBlank(),
  43. new Length(['max' => 100]),
  44. ],
  45. ]
  46. )
  47. ->add('nachname', TextType::class,
  48. [
  49. 'required' => true,
  50. 'label' => 'Name',
  51. 'attr' => ['maxlength' => 100],
  52. 'constraints' => [
  53. new NotBlank(),
  54. new Length(['max' => 100]),
  55. ],
  56. ]
  57. )
  58. ->add('firma', TextType::class,
  59. [
  60. 'required' => false,
  61. 'attr' => ['maxlength' => 100],
  62. 'constraints' => [
  63. new Length(['max' => 100]),
  64. ],
  65. ]
  66. )
  67. ->add('strasse', TextType::class,
  68. [
  69. 'required' => true,
  70. 'attr' => ['maxlength' => 100],
  71. 'constraints' => [
  72. new NotBlank(),
  73. new Length(['max' => 100]),
  74. ],
  75. 'label' => 'Strasse/Nr.',
  76. ]
  77. )
  78. ->add('plz', TextType::class,
  79. [
  80. 'label' => 'PLZ',
  81. 'required' => true,
  82. 'attr' => ['maxlength' => 100],
  83. 'constraints' => [
  84. new NotBlank(),
  85. new Length(['max' => 100]),
  86. ],
  87. ]
  88. )
  89. ->add('ort', TextType::class,
  90. [
  91. 'required' => true,
  92. 'attr' => ['maxlength' => 100],
  93. 'constraints' => [
  94. new NotBlank(),
  95. new Length(['max' => 100]),
  96. ],
  97. ]
  98. )
  99. ->add('land', TextType::class,
  100. [
  101. 'required' => true,
  102. 'attr' => ['maxlength' => 100],
  103. 'constraints' => [
  104. new NotBlank(),
  105. new Length(['max' => 100]),
  106. ],
  107. ]
  108. )
  109. ->add('telefon', TextType::class,
  110. [
  111. 'required' => true,
  112. 'attr' => ['maxlength' => 100],
  113. 'constraints' => [
  114. new NotBlank(),
  115. new Length(['max' => 100]),
  116. ],
  117. ]
  118. )
  119. ->add('email', EmailType::class,
  120. [
  121. 'required' => true,
  122. 'label' => 'E-Mail',
  123. 'attr' => ['maxlength' => 100],
  124. 'constraints' => [
  125. new NotBlank(),
  126. new Email(),
  127. new Length(['max' => 100]),
  128. ],
  129. ]
  130. )
  131. ->add('mitteilung', TextareaType::class,
  132. [
  133. 'required' => false,
  134. 'attr' => ['maxlength' => 5000],
  135. 'constraints' => [
  136. new Length(['max' => 5000]),
  137. ],
  138. ]
  139. )
  140. ->add('altVorname', TextType::class,
  141. [
  142. 'required' => true,
  143. 'label' => 'Vorname',
  144. 'attr' => ['maxlength' => 100],
  145. 'constraints' => [
  146. new NotBlank(),
  147. new Length(['max' => 100]),
  148. ],
  149. ]
  150. )
  151. ->add('altNachname', TextType::class,
  152. [
  153. 'required' => true,
  154. 'label' => 'Name',
  155. 'attr' => ['maxlength' => 100],
  156. 'constraints' => [
  157. new NotBlank(),
  158. new Length(['max' => 100]),
  159. ],
  160. ]
  161. )
  162. ->add('altFirma', TextType::class,
  163. [
  164. 'required' => false,
  165. 'label' => 'Firma',
  166. 'attr' => ['maxlength' => 100],
  167. 'constraints' => [
  168. new Length(['max' => 100]),
  169. ],
  170. ]
  171. )
  172. ->add('altStrasse', TextType::class,
  173. [
  174. 'required' => true,
  175. 'label' => 'Strasse/Nr.',
  176. 'attr' => ['maxlength' => 100],
  177. 'constraints' => [
  178. new NotBlank(),
  179. new Length(['max' => 100]),
  180. ],
  181. ]
  182. )
  183. ->add('altPlz', TextType::class,
  184. [
  185. 'required' => true,
  186. 'label' => 'PLZ',
  187. 'attr' => ['maxlength' => 100],
  188. 'constraints' => [
  189. new NotBlank(),
  190. new Length(['max' => 100]),
  191. ],
  192. ]
  193. )
  194. ->add('altOrt', TextType::class,
  195. [
  196. 'required' => true,
  197. 'label' => 'Ort',
  198. 'attr' => ['maxlength' => 100],
  199. 'constraints' => [
  200. new NotBlank(),
  201. new Length(['max' => 100]),
  202. ],
  203. ]
  204. )
  205. ->add('altLand', TextType::class,
  206. [
  207. 'required' => true,
  208. 'label' => 'Land',
  209. 'attr' => ['maxlength' => 100],
  210. 'constraints' => [
  211. new NotBlank(),
  212. new Length(['max' => 100]),
  213. ],
  214. ]
  215. )
  216. ->add('altTelefon', TextType::class,
  217. [
  218. 'required' => true,
  219. 'label' => 'Telefon',
  220. 'attr' => ['maxlength' => 100],
  221. 'constraints' => [
  222. new NotBlank(),
  223. new Length(['max' => 100]),
  224. ],
  225. ]
  226. )
  227. ->add('altEmail', EmailType::class,
  228. [
  229. 'required' => true,
  230. 'label' => 'E-Mail',
  231. 'attr' => ['maxlength' => 100],
  232. 'constraints' => [
  233. new NotBlank(),
  234. new Length(['max' => 100]),
  235. ],
  236. ]
  237. )
  238. ->add('datenschutz', CheckboxType::class,
  239. [
  240. 'mapped' => false,
  241. 'required' => true,
  242. 'label' => 'Ich habe die <a href="'.$this->router->generate('fe.page_datenschutz').'" target="_blank">Datenschutzrichtlinien</a> gelesen und bin damit einverstanden.',
  243. 'label_html' => true,
  244. 'constraints' => [
  245. new NotBlank(),
  246. ],
  247. ]
  248. )
  249. ;
  250. }
  251. }