Completed
Push — master ( 6d6774...64f3ed )
by Jeroen
11:23 queued 05:13
created

src/Kunstmaan/FormBundle/Entity/FormSubmission.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 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", cascade={"persist", "remove"})
62
     * @ORM\OrderBy({"sequence" = "ASC"})
63
     */
64
    protected $fields;
65
66
    /**
67
     * Constructor
68
     */
69 12
    public function __construct()
70
    {
71 12
        $this->fields = new ArrayCollection();
72 12
        $this->setCreated(new DateTime());
73 12
    }
74
75
    /**
76
     * Get id
77
     *
78
     * @return int
79
     */
80 4
    public function getId()
81
    {
82 4
        return $this->id;
83
    }
84
85
    /**
86
     * Set id
87
     *
88
     * @param string $id
89
     *
90
     * @return FormSubmission
91
     */
92 3
    public function setId($id)
93
    {
94 3
        $this->id = $id;
95
96 3
        return $this;
97
    }
98
99
    /**
100
     * Get the ip address which submitted this form submission
101
     *
102
     * @return string
103
     */
104 1
    public function getIpAddress()
105
    {
106 1
        return $this->ipAddress;
107
    }
108
109
    /**
110
     * Set the ip address
111
     *
112
     * @param string $ipAddress
113
     *
114
     * @return FormSubmission
115
     */
116 1
    public function setIpAddress($ipAddress)
117
    {
118 1
        $this->ipAddress = $ipAddress;
119
120 1
        return $this;
121
    }
122
123
    /**
124
     * Get the node of the form which created this form submission
125
     *
126
     * @return Node
127
     */
128 1
    public function getNode()
129
    {
130 1
        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 1
    public function setNode($node)
141
    {
142 1
        $this->node = $node;
143
144 1
        return $this;
145
    }
146
147
    /**
148
     * Sets the language of this form submission
149
     *
150
     * @param string $lang
151
     *
152
     * @return FormSubmission
153
     */
154 1
    public function setLang($lang)
155
    {
156 1
        $this->lang = $lang;
157
158 1
        return $this;
159
    }
160
161
    /**
162
     * Get the language of this form submission
163
     *
164
     * @return string
165
     */
166 2
    public function getLang()
167
    {
168 2
        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 12
    public function setCreated($created)
179
    {
180 12
        $this->created = $created;
181
182 12
        return $this;
183
    }
184
185
    /**
186
     * Get the date when this form submission was created
187
     *
188
     * @return datetime
189
     */
190 2
    public function getCreated()
191
    {
192 2
        return $this->created;
193
    }
194
195
    /**
196
     * Returns the list of fields with their values
197
     *
198
     * @return FormSubmissionField[];
199
     */
200 2
    public function getFields()
201
    {
202 2
        return $this->fields;
203
    }
204
205
    /**
206
     * A string representation of this form submission
207
     *
208
     * @return string;
0 ignored issues
show
The doc-type string; could not be parsed: Expected "|" or "end of type", but got ";" at position 6. (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...
209
     */
210 1
    public function __toString()
211
    {
212 1
        return 'FormSubmission';
213
    }
214
}
215