Passed
Push — dev ( 79c88c...be1bbd )
by Nico
05:18
created

AllianceMemberJob   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 43
ccs 4
cts 12
cp 0.3333
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getUser() 0 3 1
A setUser() 0 4 1
A getId() 0 3 1
A getJob() 0 3 1
A setJob() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Orm\Entity;
6
7
use Doctrine\ORM\Mapping\Column;
8
use Doctrine\ORM\Mapping\Entity;
9
use Doctrine\ORM\Mapping\GeneratedValue;
10
use Doctrine\ORM\Mapping\Id;
11
use Doctrine\ORM\Mapping\JoinColumn;
12
use Doctrine\ORM\Mapping\ManyToOne;
13
use Doctrine\ORM\Mapping\Table;
14
use Stu\Orm\Attribute\TruncateOnGameReset;
15
use Stu\Orm\Repository\AllianceMemberJobRepository;
16
17
#[Table(name: 'stu_alliance_member_job')]
18
#[Entity(repositoryClass: AllianceMemberJobRepository::class)]
19
#[TruncateOnGameReset]
20
class AllianceMemberJob
21
{
22
    #[Id]
23
    #[Column(type: 'integer')]
24
    #[GeneratedValue(strategy: 'IDENTITY')]
25
    private int $id;
26
27
    #[ManyToOne(targetEntity: User::class)]
28
    #[JoinColumn(name: 'user_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')]
29
    private User $user;
30
31
    #[ManyToOne(targetEntity: AllianceJob::class, inversedBy: 'memberAssignments')]
32
    #[JoinColumn(name: 'job_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')]
33
    private AllianceJob $job;
34
35
    public function getId(): int
36
    {
37
        return $this->id;
38
    }
39
40 2
    public function getUser(): User
41
    {
42 2
        return $this->user;
43
    }
44
45
    public function setUser(User $user): AllianceMemberJob
46
    {
47
        $this->user = $user;
48
        return $this;
49
    }
50
51 9
    public function getJob(): AllianceJob
52
    {
53 9
        return $this->job;
54
    }
55
56
    public function setJob(AllianceJob $job): AllianceMemberJob
57
    {
58
        $this->job = $job;
59
        return $this;
60
    }
61
}
62