Passed
Push — master ( ad0a87...920d42 )
by Nico
05:24
created

AllianceMemberJob::getUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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