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

Vote   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 47
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A prePersist() 0 3 1
A setId() 0 5 1
A getId() 0 3 1
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
}