Completed
Push — master ( e62fa2...4391c3 )
by Kristof
133:20 queued 117:59
created

src/Kunstmaan/FormBundle/Entity/FormSubmission.php (2 issues)

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 DateTime;
6
use Doctrine\Common\Collections\ArrayCollection;
7
use Doctrine\ORM\Mapping as ORM;
8
use Kunstmaan\AdminBundle\Entity\EntityInterface;
9
use Kunstmaan\NodeBundle\Entity\Node;
10
11
/**
12
 * The form submission
13
 *
14
 * @ORM\Entity
15
 * @ORM\Table(name="kuma_form_submissions")
16
 * @ORM\HasLifecycleCallbacks()
17
 */
18
class FormSubmission implements EntityInterface
19
{
20
    /**
21
     * This id of the form submission
22
     *
23
     * @ORM\Id
24
     * @ORM\Column(type="bigint")
25
     * @ORM\GeneratedValue(strategy="AUTO")
26
     */
27
    protected $id;
28
29
    /**
30
     * The ip address which created this form submission
31
     *
32
     * @ORM\Column(type="string", name="ip_address")
33
     */
34
    protected $ipAddress;
35
36
    /**
37
     * Link to the node of the form which created this form submission
38
     *
39
     * @ORM\ManyToOne(targetEntity="Kunstmaan\NodeBundle\Entity\Node")
40
     * @ORM\JoinColumn(name="node_id", referencedColumnName="id")
41
     */
42
    protected $node;
43
44
    /**
45
     * The language of the form submission
46
     *
47
     * @ORM\Column(type="string")
48
     */
49
    protected $lang;
50
51
    /**
52
     * The date when the form submission was created
53
     *
54
     * @ORM\Column(type="datetime")
55
     */
56
    protected $created;
57
58
    /**
59
     * The extra fields with their value, which where configured on the form which created this submission
60
     *
61
     * @ORM\OneToMany(targetEntity="FormSubmissionField", mappedBy="formSubmission")
62
     * @ORM\OrderBy({"sequence" = "ASC"})
63
     */
64
    protected $fields;
65
66
    /**
67
     * Constructor
68
     */
69
    public function __construct()
70
    {
71
        $this->fields = new ArrayCollection();
72
        $this->setCreated(new DateTime());
0 ignored issues
show
new \DateTime() is of type object<DateTime>, but the function expects a object<Kunstmaan\FormBundle\Entity\datetime>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
73
    }
74
75
    /**
76
     * Get id
77
     *
78
     * @return int
79
     */
80
    public function getId()
81
    {
82
        return $this->id;
83
    }
84
85
    /**
86
     * Set id
87
     *
88
     * @param string $id
89
     *
90
     * @return FormSubmission
91
     */
92
    public function setId($id)
93
    {
94
        $this->id = $id;
95
96
        return $this;
97
    }
98
99
    /**
100
     * Get the ip address which submitted this form submission
101
     *
102
     * @return string
103
     */
104
    public function getIpAddress()
105
    {
106
        return $this->ipAddress;
107
    }
108
109
    /**
110
     * Set the ip address
111
     *
112
     * @param string $ipAddress
113
     *
114
     * @return FormSubmission
115
     */
116
    public function setIpAddress($ipAddress)
117
    {
118
        $this->ipAddress = $ipAddress;
119
120
        return $this;
121
    }
122
123
    /**
124
     * Get the node of the form which created this form submission
125
     *
126
     * @return Node
127
     */
128
    public function getNode()
129
    {
130
        return $this->node;
131
    }
132
133
    /**
134
     * Set the node of the form which created this form submission
135
     *
136
     * @param Node $node
137
     *
138
     * @return FormSubmission
139
     */
140
    public function setNode($node)
141
    {
142
        $this->node = $node;
143
144
        return $this;
145
    }
146
147
    /**
148
     * Sets the language of this form submission
149
     *
150
     * @param string $lang
151
     *
152
     * @return FormSubmission
153
     */
154
    public function setLang($lang)
155
    {
156
        $this->lang = $lang;
157
158
        return $this;
159
    }
160
161
    /**
162
     * Get the language of this form submission
163
     *
164
     * @return string
165
     */
166
    public function getLang()
167
    {
168
        return $this->lang;
169
    }
170
171
    /**
172
     * Set the date when the form submission was created
173
     *
174
     * @param datetime $created
175
     *
176
     * @return FormSubmission
177
     */
178
    public function setCreated($created)
179
    {
180
        $this->created = $created;
181
182
        return $this;
183
    }
184
185
    /**
186
     * Get the date when this form submission was created
187
     *
188
     * @return datetime
189
     */
190
    public function getCreated()
191
    {
192
        return $this->created;
193
    }
194
195
    /**
196
     * Returns the list of fields with their values
197
     *
198
     * @return FormSubmissionField[];
0 ignored issues
show
The doc-type FormSubmissionField[]; could not be parsed: Expected "|" or "end of type", but got ";" at position 21. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
199
     */
200
    public function getFields()
201
    {
202
        return $this->fields;
203
    }
204
205
    /**
206
     * A string representation of this form submission
207
     *
208
     * @return string;
209
     */
210
    public function __toString()
211
    {
212
        return 'FormSubmission';
213
    }
214
}
215