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

Notification   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

3 Methods

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