Completed
Push — develop ( 8b48d6...0ad85f )
by greg
10:00
created

PostVoteVote::setPostvote()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
namespace PlaygroundGame\Entity;
3
4
use Doctrine\ORM\Mapping as ORM;
5
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
6
use Doctrine\ORM\Mapping\PrePersist;
7
use Doctrine\ORM\Mapping\PreUpdate;
8
use Zend\InputFilter\InputFilter;
9
use Zend\InputFilter\InputFilterAwareInterface;
10
use Zend\InputFilter\InputFilterInterface;
11
12
/**
13
 * @ORM\Entity @HasLifecycleCallbacks
14
 * @ORM\Table(name="game_postvote_vote")
15
 */
16
class PostVoteVote implements InputFilterAwareInterface
17
{
18
    protected $inputFilter;
19
20
    /**
21
     * @ORM\Id
22
     * @ORM\Column(type="integer");
23
     * @ORM\GeneratedValue(strategy="AUTO")
24
     */
25
    protected $id;
26
27
    /**
28
     * @ORM\ManyToOne(targetEntity="PostVotePost", inversedBy="votes")
29
     * @ORM\JoinColumn(name="post_id", referencedColumnName="id", onDelete="CASCADE")
30
     **/
31
    protected $post;
32
33
    /**
34
     * @ORM\ManyToOne(targetEntity="PostVote")
35
     **/
36
    protected $postvote;
37
38
    /**
39
     * @ORM\ManyToOne(targetEntity="PlaygroundUser\Entity\User")
40
     * @ORM\JoinColumn(name="user_id", referencedColumnName="user_id", onDelete="CASCADE")
41
     */
42
    protected $user;
43
    
44
45
    /**
46
     * @ORM\Column(type="text", nullable=true)
47
     */
48
    protected $ip;
49
50
    /**
51
     * @ORM\Column(type="text", nullable=true)
52
     */
53
    protected $message;
54
55
    /**
56
     * @ORM\Column(type="string", nullable=true)
57
     */
58
    protected $note;
59
60
    /**
61
     * @ORM\Column(name="created_at", type="datetime")
62
     */
63
    protected $createdAt;
64
65
    /**
66
     * @ORM\Column(name="updated_at", type="datetime")
67
     */
68
    protected $updatedAt;
69
70
    /** @PrePersist */
71
    public function createChrono()
72
    {
73
        $this->createdAt = new \DateTime("now");
74
        $this->updatedAt = new \DateTime("now");
75
    }
76
77
    /** @PreUpdate */
78
    public function updateChrono()
79
    {
80
        $this->updatedAt = new \DateTime("now");
81
    }
82
83
    /**
84
     * @return the unknown_type
85
     */
86
    public function getId()
87
    {
88
        return $this->id;
89
    }
90
91
    /**
92
     * @param unknown_type $id
93
     */
94
    public function setId($id)
95
    {
96
        $this->id = $id;
97
98
        return $this;
99
    }
100
101
    /**
102
     * @return string unknown_type
103
     */
104
    public function getIp()
105
    {
106
        return $this->ip;
107
    }
108
109
    /**
110
     * @param string $ip
111
     */
112
    public function setIp($ip)
113
    {
114
        $this->ip = $ip;
115
116
        return $this;
117
    }
118
119
   /**
120
    * @return the unknown_type
121
    */
122
    public function getUser()
123
    {
124
        return $this->user;
125
    }
126
127
    /**
128
     * @param unknown_type $user
129
     */
130
    public function setUser($user)
131
    {
132
        $this->user = $user;
133
134
        return $this;
135
    }
136
137
    /**
138
     * @return the unknown_type
139
     */
140
    public function getPost()
141
    {
142
        return $this->post;
143
    }
144
145
    /**
146
     * @param unknown_type $post
147
     */
148
    public function setPost($post)
149
    {
150
        // Check that there is no drawback using the cascading update from PostVoteEntry
151
        $post->addVote($this);
152
        $this->post = $post;
153
154
        return $this;
155
    }
156
157
    /**
158
     * @return the unknown_type
159
     */
160
    public function getPostvote()
161
    {
162
        return $this->postvote;
163
    }
164
165
    /**
166
     * @param unknown_type $postvote
167
     */
168
    public function setPostvote($postvote)
169
    {
170
        
171
        $this->postvote = $postvote;
172
173
        return $this;
174
    }
175
176
    /**
177
    * @return the unknown_type
178
    */
179
    public function getMessage()
180
    {
181
        return $this->message;
182
    }
183
184
    /**
185
     * @param unknown_type $message
186
     */
187
    public function setMessage($message)
188
    {
189
        $this->message = $message;
190
191
        return $this;
192
    }
193
194
    /**
195
    * @return the unknown_type
196
    */
197
    public function getNote()
198
    {
199
        return $this->note;
200
    }
201
202
    /**
203
     * @param unknown_type $note
204
     */
205
    public function setNote($note)
206
    {
207
        $this->note = $note;
208
209
        return $this;
210
    }
211
212
    /**
213
     * @return the unknown_type
214
     */
215
    public function getCreatedAt()
216
    {
217
        return $this->createdAt;
218
    }
219
220
    /**
221
     * @param unknown_type $createdAt
222
     */
223
    public function setCreatedAt($createdAt)
224
    {
225
        $this->createdAt = $createdAt;
226
227
        return $this;
228
    }
229
230
    /**
231
     * @return the unknown_type
232
     */
233
    public function getUpdatedAt()
234
    {
235
        return $this->updatedAt;
236
    }
237
238
    /**
239
     * @param unknown_type $updatedAt
240
     */
241
    public function setUpdatedAt($updatedAt)
242
    {
243
        $this->updatedAt = $updatedAt;
244
245
        return $this;
246
    }
247
248
    /**
249
     * Convert the object to an array.
250
     *
251
     * @return array
252
     */
253
    public function getArrayCopy()
254
    {
255
        $obj_vars = get_object_vars($this);
256
257
        return $obj_vars;
258
    }
259
260
    /**
261
     * Populate from an array.
262
     *
263
     * @param array $data
264
     */
265
    public function populate($data = array())
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
266
    {
267
    }
268
269
    public function setInputFilter(InputFilterInterface $inputFilter)
270
    {
271
        throw new \Exception("Not used");
272
    }
273
274
    public function getInputFilter()
275
    {
276
        if (!$this->inputFilter) {
277
            $inputFilter = new InputFilter();
278
279
            $this->inputFilter = $inputFilter;
280
        }
281
282
        return $this->inputFilter;
283
    }
284
}
285