These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\FormBundle\Entity; |
||
4 | |||
5 | use Doctrine\ORM\Mapping as ORM; |
||
6 | |||
7 | use Symfony\Component\DependencyInjection\ContainerInterface; |
||
8 | use Symfony\Component\Form\Form; |
||
9 | use Symfony\Component\Form\FormBuilderInterface; |
||
10 | use Symfony\Component\HttpFoundation\Request; |
||
11 | |||
12 | /** |
||
13 | * The FormSubmissionField will hold the submitted values from the form page parts. The FormSubmissionFields |
||
14 | * will be attached to a FormSubmission. |
||
15 | * |
||
16 | * @ORM\Entity |
||
17 | * @ORM\Table(name="kuma_form_submission_fields") |
||
18 | * @ORM\InheritanceType("SINGLE_TABLE") |
||
19 | * @ORM\DiscriminatorColumn(name="discr", type="string") |
||
20 | */ |
||
21 | abstract class FormSubmissionField |
||
22 | { |
||
23 | /** |
||
24 | * This id of this FormSubmissionField |
||
25 | * |
||
26 | * @ORM\Id |
||
27 | * @ORM\Column(type="bigint") |
||
28 | * @ORM\GeneratedValue(strategy="AUTO") |
||
29 | */ |
||
30 | protected $id; |
||
31 | |||
32 | /** |
||
33 | * The name of this FormSubmissionField |
||
34 | * |
||
35 | * @ORM\Column(type="string") |
||
36 | */ |
||
37 | protected $fieldName; |
||
38 | |||
39 | /** |
||
40 | * The label used for this FormSubmissionField |
||
41 | * |
||
42 | * @ORM\Column(type="string") |
||
43 | */ |
||
44 | protected $label; |
||
45 | |||
46 | /** |
||
47 | * The FormSubmission this field is part of |
||
48 | * |
||
49 | * @ORM\ManyToOne(targetEntity="FormSubmission", inversedBy="fields") |
||
50 | * @ORM\JoinColumn(name="form_submission_id", referencedColumnName="id") |
||
51 | */ |
||
52 | protected $formSubmission; |
||
53 | |||
54 | /** |
||
55 | * @ORM\Column(type="integer", nullable=true) |
||
56 | */ |
||
57 | protected $sequence; |
||
58 | |||
59 | /** |
||
60 | * Get id |
||
61 | * |
||
62 | * @return integer |
||
63 | */ |
||
64 | public function getId() |
||
65 | { |
||
66 | return $this->id; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * Set id |
||
71 | * |
||
72 | * @param string $id |
||
73 | * |
||
74 | * @return FormSubmissionField |
||
75 | */ |
||
76 | public function setId($id) |
||
77 | { |
||
78 | $this->id = $id; |
||
79 | |||
80 | return $this; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * Get the field name |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | public function getFieldName() |
||
89 | { |
||
90 | return $this->fieldName; |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * Set the field name |
||
95 | * |
||
96 | * @param string $fieldName |
||
97 | * |
||
98 | * @return FormSubmissionField |
||
99 | */ |
||
100 | public function setFieldName($fieldName) |
||
101 | { |
||
102 | $this->fieldName = $fieldName; |
||
103 | |||
104 | return $this; |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * Get the label |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | public function getLabel() |
||
113 | { |
||
114 | return $this->label; |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * Set the label |
||
119 | * |
||
120 | * @param string $label |
||
121 | * |
||
122 | * @return FormSubmissionField |
||
123 | */ |
||
124 | public function setLabel($label) |
||
125 | { |
||
126 | $this->label = $label; |
||
127 | |||
128 | return $this; |
||
129 | } |
||
130 | |||
131 | /** |
||
132 | * Get the FormSubmission this field is part of |
||
133 | * |
||
134 | * @return FormSubmission |
||
135 | */ |
||
136 | public function getSubmission() |
||
137 | { |
||
138 | return $this->formSubmission; |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * Set the FormSubmission this field is part of |
||
143 | * |
||
144 | * @param FormSubmission $formSubmission |
||
145 | * |
||
146 | * @return FormSubmissionField |
||
147 | */ |
||
148 | public function setSubmission(FormSubmission $formSubmission) |
||
149 | { |
||
150 | $this->formSubmission = $formSubmission; |
||
151 | |||
152 | return $this; |
||
153 | } |
||
154 | |||
155 | /** |
||
156 | * Get sequence |
||
157 | * |
||
158 | * @return integer |
||
0 ignored issues
–
show
|
|||
159 | */ |
||
160 | public function getSequence() |
||
161 | { |
||
162 | return $this->sequence; |
||
163 | } |
||
164 | |||
165 | /** |
||
166 | * Set sequence |
||
167 | * |
||
168 | * @param string $sequence |
||
169 | * |
||
170 | * @return FormSubmissionField |
||
171 | */ |
||
172 | public function setSequence($sequence) |
||
173 | { |
||
174 | $this->sequence = $sequence; |
||
175 | |||
176 | return $this; |
||
177 | } |
||
178 | |||
179 | /** |
||
180 | * Text representation of this field |
||
181 | * |
||
182 | * @return string |
||
183 | */ |
||
184 | public function __toString() |
||
185 | { |
||
186 | return "FormSubmission Field"; |
||
187 | } |
||
188 | |||
189 | /** |
||
190 | * This function will be triggered if the form was successfully posted. |
||
191 | * |
||
192 | * @param Form $form the Form |
||
193 | * @param FormBuilderInterface $formBuilder the FormBuilder |
||
194 | * @param Request $request the Request |
||
195 | * @param ContainerInterface $container the Container |
||
196 | */ |
||
197 | public function onValidPost(Form $form, FormBuilderInterface $formBuilder, Request $request, ContainerInterface $container) |
||
198 | { |
||
199 | // do nothing by default |
||
200 | } |
||
201 | } |
||
202 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.