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

Notification::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\User;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
use App\Model\User\Notification as NotificationModel;
8
9
/**
10
 * @ORM\Entity(repositoryClass="App\Repository\User\NotificationRepository")
11
 * @ORM\Table(name="users__notifications")
12
 * @ORM\HasLifecycleCallbacks
13
 */
14
class Notification extends NotificationModel
15
{
16
    /**
17
     * @ORM\Id
18
     * @ORM\GeneratedValue(strategy="AUTO")
19
     * @ORM\Column(type="integer")
20
     */
21
    protected $id;
22
    /**
23
     * @ORM\ManyToOne(targetEntity="User")
24
     */
25
    protected $user;
26
    /**
27
     * @ORM\Column(type="string", length=255)
28
     */
29
    protected $content;
30
    /**
31
     * @ORM\Column(type="datetime")
32
     */
33
    protected $createdAt;
34
    /**
35
     * @ORM\Column(type="datetime", nullable=true)
36
     */
37
    protected $readAt;
38
    
39
    /**
40
     * @ORM\PrePersist()
41
     */
42
    public function prePersist()
43
    {
44
        $this->createdAt = new \DateTime();
45
    }
46
    
47
    public function setId(int $id): Notification
48
    {
49
        $this->id = $id;
50
        
51
        return $this;
52
    }
53
    
54
    public function getId(): int
55
    {
56
        return $this->id;
57
    }
58
}