1 | <?php |
||
14 | abstract class Form implements FormInterface |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $name; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $method; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | private $options; |
||
31 | |||
32 | /** |
||
33 | * @var \stdClass|null |
||
34 | */ |
||
35 | private $object; |
||
36 | |||
37 | /** |
||
38 | * @var null|\ValidatorInterface |
||
39 | */ |
||
40 | private $validator; |
||
41 | |||
42 | /** |
||
43 | * @var array|FormElementInterface[] |
||
44 | */ |
||
45 | private $elements; |
||
46 | |||
47 | /** |
||
48 | * Form constructor. |
||
49 | * |
||
50 | * @param string $name |
||
51 | * @param string $method |
||
52 | * @param array $options |
||
53 | */ |
||
54 | public function __construct($name, $method = FormInterface::METHOD_GET, array $options = []) |
||
61 | |||
62 | /** |
||
63 | * @inheritDoc |
||
64 | */ |
||
65 | public function getName() |
||
69 | |||
70 | /** |
||
71 | * @inheritDoc |
||
72 | */ |
||
73 | public function getMethod() |
||
77 | |||
78 | /** |
||
79 | * @inheritDoc |
||
80 | */ |
||
81 | public function getOptions() |
||
85 | |||
86 | /** |
||
87 | * @inheritDoc |
||
88 | */ |
||
89 | public function add(FormElementInterface $element) |
||
96 | |||
97 | /** |
||
98 | * @inheritDoc |
||
99 | */ |
||
100 | public function remove($fieldName) |
||
105 | |||
106 | /** |
||
107 | * @inheritDoc |
||
108 | */ |
||
109 | public function has($fieldName) |
||
113 | |||
114 | /** |
||
115 | * @inheritDoc |
||
116 | */ |
||
117 | public function validate() |
||
137 | |||
138 | /** |
||
139 | * @return array|string[] |
||
140 | */ |
||
141 | public function getErrorMessages() |
||
145 | |||
146 | /** |
||
147 | * @param null|\ValidatorInterface $validator |
||
148 | * |
||
149 | * @return Form |
||
150 | */ |
||
151 | protected function setValidator(ValidatorInterface $validator) |
||
156 | |||
157 | |||
158 | /** |
||
159 | * @inheritDoc |
||
160 | */ |
||
161 | public function bind($object) |
||
177 | |||
178 | /** |
||
179 | * @inheritDoc |
||
180 | */ |
||
181 | public function setData(array $data) |
||
208 | |||
209 | /** |
||
210 | * @inheritDoc |
||
211 | */ |
||
212 | public function getObject() |
||
216 | |||
217 | /** |
||
218 | * @inheritDoc |
||
219 | */ |
||
220 | public function getElement($elementName) |
||
228 | |||
229 | /** |
||
230 | * @param string $name |
||
231 | * |
||
232 | * @return string |
||
233 | */ |
||
234 | private function camelCase($name) |
||
239 | |||
240 | } |