Completed
Pull Request — 5.6 (#2830)
by Jeroen
14:14
created

FormBundle/Entity/FormSubmissionField.php (1 issue)

Upgrade to new PHP Analysis Engine

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
use Symfony\Component\DependencyInjection\ContainerInterface;
7
use Symfony\Component\Form\Form;
8
use Symfony\Component\Form\FormBuilderInterface;
9
use Symfony\Component\HttpFoundation\Request;
10
11
/**
12
 * The FormSubmissionField will hold the submitted values from the form page parts. The FormSubmissionFields
13
 * will be attached to a FormSubmission.
14
 *
15
 * @ORM\Entity
16
 * @ORM\Table(name="kuma_form_submission_fields")
17
 * @ORM\InheritanceType("SINGLE_TABLE")
18
 * @ORM\DiscriminatorColumn(name="discr", type="string")
19
 */
20
abstract class FormSubmissionField
21
{
22
    /**
23
     * This id of this FormSubmissionField
24
     *
25
     * @ORM\Id
26
     * @ORM\Column(type="bigint")
27
     * @ORM\GeneratedValue(strategy="AUTO")
28
     */
29
    protected $id;
30
31
    /**
32
     * The name of this FormSubmissionField
33
     *
34
     * @ORM\Column(type="string")
35
     */
36
    protected $fieldName;
37
38
    /**
39
     * The label used for this FormSubmissionField
40
     *
41
     * @ORM\Column(type="string")
42
     */
43
    protected $label;
44
45
    /**
46
     * The FormSubmission this field is part of
47
     *
48
     * @ORM\ManyToOne(targetEntity="FormSubmission", inversedBy="fields")
49
     * @ORM\JoinColumn(name="form_submission_id", referencedColumnName="id", onDelete="CASCADE")
50
     */
51
    protected $formSubmission;
52
53
    /**
54
     * @ORM\Column(type="integer", nullable=true)
55
     */
56
    protected $sequence;
57
58
    /**
59
     * The internal name of the form pagepart attached to this.
60
     *
61
     * @ORM\Column(name="internal_name", type="string", nullable=true)
62
     */
63
    protected $internalName;
64
65
    /**
66
     * Get id
67
     *
68
     * @return int
69
     */
70 1
    public function getId()
71
    {
72 1
        return $this->id;
73
    }
74
75
    /**
76
     * Set id
77
     *
78
     * @param string $id
79
     *
80
     * @return FormSubmissionField
81
     */
82 1
    public function setId($id)
83
    {
84 1
        $this->id = $id;
85
86 1
        return $this;
87
    }
88
89
    /**
90
     * Get the field name
91
     *
92
     * @return string
93
     */
94 2
    public function getFieldName()
95
    {
96 2
        return $this->fieldName;
97
    }
98
99
    /**
100
     * Set the field name
101
     *
102
     * @param string $fieldName
103
     *
104
     * @return FormSubmissionField
105
     */
106 10
    public function setFieldName($fieldName)
107
    {
108 10
        $this->fieldName = $fieldName;
109
110 10
        return $this;
111
    }
112
113
    /**
114
     * Get the label
115
     *
116
     * @return string
117
     */
118 2
    public function getLabel()
119
    {
120 2
        return $this->label;
121
    }
122
123
    /**
124
     * Set the label
125
     *
126
     * @param string $label
127
     *
128
     * @return FormSubmissionField
129
     */
130 7
    public function setLabel($label)
131
    {
132 7
        $this->label = $label;
133
134 7
        return $this;
135
    }
136
137
    /**
138
     * Get the FormSubmission this field is part of
139
     *
140
     * @return FormSubmission
141
     */
142 1
    public function getSubmission()
143
    {
144 1
        return $this->formSubmission;
145
    }
146
147
    /**
148
     * Set the FormSubmission this field is part of
149
     *
150
     * @return FormSubmissionField
151
     */
152 1
    public function setSubmission(FormSubmission $formSubmission)
153
    {
154 1
        $this->formSubmission = $formSubmission;
155
156 1
        return $this;
157
    }
158
159
    /**
160
     * Get sequence
161
     *
162
     * @return int
0 ignored issues
show
Should the return type not be string?

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.

Loading history...
163
     */
164 2
    public function getSequence()
165
    {
166 2
        return $this->sequence;
167
    }
168
169
    /**
170
     * Set sequence
171
     *
172
     * @param string $sequence
173
     *
174
     * @return FormSubmissionField
175
     */
176 7
    public function setSequence($sequence)
177
    {
178 7
        $this->sequence = $sequence;
179
180 7
        return $this;
181
    }
182
183
    /**
184
     * @return mixed
185
     */
186
    public function getFormSubmission()
187
    {
188
        return $this->formSubmission;
189
    }
190
191
    /**
192
     * @param mixed $formSubmission
193
     */
194
    public function setFormSubmission($formSubmission)
195
    {
196
        $this->formSubmission = $formSubmission;
197
    }
198
199
    /**
200
     * @return mixed
201
     */
202
    public function getInternalName()
203
    {
204
        return $this->internalName;
205
    }
206
207
    /**
208
     * @param mixed $internalName
209
     */
210
    public function setInternalName($internalName)
211
    {
212
        $this->internalName = $internalName;
213
    }
214
215
    /**
216
     * Text representation of this field
217
     *
218
     * @return string
219
     */
220 1
    public function __toString()
221
    {
222 1
        return 'FormSubmission Field';
223
    }
224
225
    /**
226
     * This function will be triggered if the form was successfully posted.
227
     *
228
     * @param Form                 $form        the Form
229
     * @param FormBuilderInterface $formBuilder the FormBuilder
230
     * @param Request              $request     the Request
231
     * @param ContainerInterface   $container   the Container
232
     */
233
    public function onValidPost(Form $form, FormBuilderInterface $formBuilder, Request $request, ContainerInterface $container)
234
    {
235
        // do nothing by default
236
    }
237
}
238