|
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\Index; |
|
12
|
|
|
use Doctrine\ORM\Mapping\JoinColumn; |
|
13
|
|
|
use Doctrine\ORM\Mapping\ManyToOne; |
|
14
|
|
|
use Doctrine\ORM\Mapping\Table; |
|
15
|
|
|
use Stu\Orm\Repository\BuildingUpgradeCostRepository; |
|
16
|
|
|
|
|
17
|
|
|
#[Table(name: 'stu_buildings_upgrades_cost')] |
|
18
|
|
|
#[Index(name: 'buildings_upgrades_idx', columns: ['buildings_upgrades_id'])] |
|
19
|
|
|
#[Entity(repositoryClass: BuildingUpgradeCostRepository::class)] |
|
20
|
|
|
class BuildingUpgradeCost |
|
21
|
|
|
{ |
|
22
|
|
|
#[Id] |
|
23
|
|
|
#[Column(type: 'integer')] |
|
24
|
|
|
#[GeneratedValue(strategy: 'IDENTITY')] |
|
25
|
|
|
private int $id; |
|
26
|
|
|
|
|
27
|
|
|
#[Column(type: 'bigint')] |
|
28
|
|
|
private int $buildings_upgrades_id; |
|
29
|
|
|
|
|
30
|
|
|
#[Column(type: 'integer')] |
|
31
|
|
|
private int $commodity_id; |
|
32
|
|
|
|
|
33
|
|
|
#[Column(type: 'integer')] |
|
34
|
|
|
private int $amount; |
|
35
|
|
|
|
|
36
|
|
|
#[ManyToOne(targetEntity: Commodity::class)] |
|
37
|
|
|
#[JoinColumn(name: 'commodity_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
38
|
|
|
private Commodity $commodity; |
|
39
|
|
|
|
|
40
|
|
|
#[ManyToOne(targetEntity: BuildingUpgrade::class)] |
|
41
|
|
|
#[JoinColumn(name: 'buildings_upgrades_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
42
|
|
|
private BuildingUpgrade $upgrade; |
|
43
|
|
|
|
|
44
|
|
|
public function getId(): int |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->id; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function setBuildingUpgradeId(int $building_upgrade_id): BuildingUpgradeCost |
|
50
|
|
|
{ |
|
51
|
|
|
$this->buildings_upgrades_id = $building_upgrade_id; |
|
52
|
|
|
|
|
53
|
|
|
return $this; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function getBuildingUpgradeId(): int |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->buildings_upgrades_id; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function setCommodityId(int $commodityId): BuildingUpgradeCost |
|
62
|
|
|
{ |
|
63
|
|
|
$this->commodity_id = $commodityId; |
|
64
|
|
|
|
|
65
|
|
|
return $this; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function getCommodityId(): int |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->commodity_id; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function setAmount(int $amount): BuildingUpgradeCost |
|
74
|
|
|
{ |
|
75
|
|
|
$this->amount = $amount; |
|
76
|
|
|
|
|
77
|
|
|
return $this; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function getAmount(): int |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->amount; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
public function getCommodity(): Commodity |
|
86
|
|
|
{ |
|
87
|
|
|
return $this->commodity; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
public function getUpgrade(): BuildingUpgrade |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->upgrade; |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|