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\TerraformingCostRepository; |
16
|
|
|
|
17
|
|
|
#[Table(name: 'stu_terraforming_cost')] |
18
|
|
|
#[Index(name: 'terraforming_idx', columns: ['terraforming_id'])] |
19
|
|
|
#[Entity(repositoryClass: TerraformingCostRepository::class)] |
20
|
|
|
class TerraformingCost |
21
|
|
|
{ |
22
|
|
|
#[Id] |
23
|
|
|
#[Column(type: 'integer')] |
24
|
|
|
#[GeneratedValue(strategy: 'IDENTITY')] |
25
|
|
|
private int $id; |
26
|
|
|
|
27
|
|
|
#[Column(type: 'integer')] |
28
|
|
|
private int $terraforming_id = 0; |
29
|
|
|
|
30
|
|
|
#[Column(type: 'integer')] |
31
|
|
|
private int $commodity_id = 0; |
32
|
|
|
|
33
|
|
|
#[Column(type: 'integer')] |
34
|
|
|
private int $count = 0; |
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: Terraforming::class)] |
41
|
|
|
#[JoinColumn(name: 'terraforming_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')] |
42
|
|
|
private Terraforming $terraforming; |
43
|
|
|
|
44
|
|
|
public function getId(): int |
45
|
|
|
{ |
46
|
|
|
return $this->id; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function getTerraformingId(): int |
50
|
|
|
{ |
51
|
|
|
return $this->terraforming_id; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function setTerraformingId(int $terraformingId): TerraformingCost |
55
|
|
|
{ |
56
|
|
|
$this->terraforming_id = $terraformingId; |
57
|
|
|
|
58
|
|
|
return $this; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function getCommodityId(): int |
62
|
|
|
{ |
63
|
|
|
return $this->commodity_id; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function setCommodityId(int $commodityId): TerraformingCost |
67
|
|
|
{ |
68
|
|
|
$this->commodity_id = $commodityId; |
69
|
|
|
|
70
|
|
|
return $this; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function getAmount(): int |
74
|
|
|
{ |
75
|
|
|
return $this->count; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function setAmount(int $amount): TerraformingCost |
79
|
|
|
{ |
80
|
|
|
$this->count = $amount; |
81
|
|
|
|
82
|
|
|
return $this; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function getCommodity(): Commodity |
86
|
|
|
{ |
87
|
|
|
return $this->commodity; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function getTerraforming(): Terraforming |
91
|
|
|
{ |
92
|
|
|
return $this->terraforming; |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|