Favorite   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
eloc 29
dl 0
loc 66
ccs 20
cts 20
cp 1
rs 10
c 1
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setDate() 0 4 1
A setUser() 0 4 1
A getItemId() 0 3 1
A getDate() 0 3 1
A setType() 0 4 1
A getType() 0 3 1
A setItemId() 0 4 1
A getUser() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Orm\Model;
6
7
use DateTimeInterface;
8
use Doctrine\DBAL\Types\Types;
9
use Doctrine\ORM\Mapping as ORM;
10
use Uxmp\Core\Orm\Repository\FavoriteRepository;
11
12
#[ORM\Entity(repositoryClass: FavoriteRepository::class)]
13
#[ORM\Table(name: 'favorite')]
14
class Favorite implements FavoriteInterface
15
{
16
    #[ORM\Column(type: Types::INTEGER)]
17
    #[ORM\Id, ORM\GeneratedValue(strategy: 'AUTO')]
18
    private int $id;
0 ignored issues
show
introduced by
The private property $id is not used, and could be removed.
Loading history...
19
20
    #[ORM\Column(type: Types::INTEGER)]
21
    private int $user_id;
0 ignored issues
show
introduced by
The private property $user_id is not used, and could be removed.
Loading history...
22
23
    #[ORM\Column(type: Types::INTEGER)]
24
    private int $item_id;
25
26
    #[ORM\Column(type: Types::STRING, enumType: FavoriteItemTypeEnum::class)]
27
    private FavoriteItemTypeEnum $type;
28
29
    #[ORM\Column(type: Types::DATETIME_MUTABLE)]
30
    private DateTimeInterface $date;
31
32
    #[ORM\ManyToOne(targetEntity: UserInterface::class)]
33
    #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
34
    private UserInterface $user;
35
36 1
    public function setUser(UserInterface $user): FavoriteInterface
37
    {
38 1
        $this->user = $user;
39 1
        return $this;
40
    }
41
42 1
    public function getUser(): UserInterface
43
    {
44 1
        return $this->user;
45
    }
46
47 1
    public function setItemId(int $itemId): FavoriteInterface
48
    {
49 1
        $this->item_id = $itemId;
50 1
        return $this;
51
    }
52
53 1
    public function getItemId(): int
54
    {
55 1
        return $this->item_id;
56
    }
57
58 1
    public function setType(FavoriteItemTypeEnum $type): FavoriteInterface
59
    {
60 1
        $this->type = $type;
61 1
        return $this;
62
    }
63
64 1
    public function getType(): FavoriteItemTypeEnum
65
    {
66 1
        return $this->type;
67
    }
68
69 1
    public function setDate(DateTimeInterface $date): FavoriteInterface
70
    {
71 1
        $this->date = $date;
72 1
        return $this;
73
    }
74
75 1
    public function getDate(): DateTimeInterface
76
    {
77 1
        return $this->date;
78
    }
79
}
80