Passed
Pull Request — master (#2341)
by Nico
05:38
created

LocationMining::setMaxAmount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
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\Repository\LocationMiningRepository;
15
16
#[Table(name: 'stu_location_mining')]
17
#[Entity(repositoryClass: LocationMiningRepository::class)]
18
class LocationMining
19
{
20
    #[Id]
21
    #[Column(type: 'integer')]
22
    #[GeneratedValue(strategy: 'IDENTITY')]
23
    private int $id;
24
25
    #[Column(type: 'integer')]
26
    private int $commodity_id;
27
28
    #[Column(type: 'integer')]
29
    private int $actual_amount;
30
31
    #[Column(type: 'integer')]
32
    private int $max_amount;
33
34
    #[Column(type: 'integer', nullable: true)]
35
    private ?int $depleted_at = null;
36
37
    #[ManyToOne(targetEntity: Location::class, inversedBy: 'locationMinings')]
38
    #[JoinColumn(name: 'location_id', nullable: false, referencedColumnName: 'id')]
39
    private Location $location;
40
41
    #[ManyToOne(targetEntity: Commodity::class)]
42
    #[JoinColumn(name: 'commodity_id', nullable: false, referencedColumnName: 'id')]
43
    private Commodity $commodity;
44
45
    public function getId(): int
46
    {
47
        return $this->id;
48
    }
49
50 1
    public function getLocationId(): int
51
    {
52 1
        return $this->location->getId();
53
    }
54
55
    public function getCommodityId(): int
56
    {
57
        return $this->commodity_id;
58
    }
59
60
    public function setCommodityId(int $commodity_id): void
61
    {
62
        $this->commodity_id = $commodity_id;
63
    }
64
65
    public function getActualAmount(): int
66
    {
67
        return $this->actual_amount;
68
    }
69
70
    public function setActualAmount(int $actual_amount): void
71
    {
72
        $this->actual_amount = $actual_amount;
73
    }
74
75
    public function getMaxAmount(): int
76
    {
77
        return $this->max_amount;
78
    }
79
80
    public function setMaxAmount(int $max_amount): void
81
    {
82
        $this->max_amount = $max_amount;
83
    }
84
85
    public function getDepletedAt(): ?int
86
    {
87
        return $this->depleted_at;
88
    }
89
90
    public function setDepletedAt(?int $depleted_at): void
91
    {
92
        $this->depleted_at = $depleted_at;
93
    }
94
95
    public function getLocation(): Location
96
    {
97
        return $this->location;
98
    }
99
100
    public function setLocation(Location $location): void
101
    {
102
        $this->location = $location;
103
    }
104
105 1
    public function getCommodity(): Commodity
106
    {
107 1
        return $this->commodity;
108
    }
109
110
    public function setCommodity(Commodity $commodity): void
111
    {
112
        $this->commodity = $commodity;
113
    }
114
}
115