Completed
Push — master ( 1e7ae1...1641c1 )
by Axel
04:29
created

Vote::setId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Entity\Project;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
use App\Model\Project\Vote as VoteModel;
8
9
/**
10
 * @ORM\Table(name="project__votes")
11
 * @ORM\Entity()
12
 * @ORM\HasLifecycleCallbacks()
13
 */
14
class Vote extends VoteModel
15
{
16
    /**
17
     * @ORM\Id
18
     * @ORM\GeneratedValue(strategy="AUTO")
19
     * @ORM\Column(type="integer")
20
     */
21
    protected $id;
22
    /**
23
     * @ORM\ManyToOne(targetEntity="Poll")
24
     */
25
    protected $poll;
26
    /**
27
     * @ORM\ManyToOne(targetEntity="App\Entity\User\User")
28
     */
29
    protected $user;
30
    /**
31
     * @ORM\Column(type="string")
32
     */
33
    protected $option;
34
    /**
35
     * @ORM\Column(type="boolean")
36
     */
37
    protected $isPositive;
38
    /**
39
     * @ORM\Column(type="datetime")
40
     */
41
    protected $createdAt;
42
    
43
    /**
44
     * @ORM\PrePersist()
45
     */
46
    public function prePersist()
47
    {
48
        $this->createdAt = new \DateTime();
49
    }
50
    
51
    public function setId(int $id): Vote
52
    {
53
        $this->id = $id;
54
        
55
        return $this;
56
    }
57
    
58
    public function getId(): int
59
    {
60
        return $this->id;
61
    }
62
}