-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodel.php
192 lines (151 loc) · 4.24 KB
/
model.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?php
declare(strict_types=1);
use Autoprotect\DynamodbODM\Annotation\Key\Primary;
use Autoprotect\DynamodbODM\Annotation\Types\BooleanType;
use Autoprotect\DynamodbODM\Annotation\Types\CollectionType;
use Autoprotect\DynamodbODM\Annotation\Types\DateType;
use Autoprotect\DynamodbODM\Annotation\Types\FloatType;
use Autoprotect\DynamodbODM\Annotation\Types\HashMapType;
use Autoprotect\DynamodbODM\Annotation\Types\IntegerType;
use Autoprotect\DynamodbODM\Annotation\Types\ModelType;
use Autoprotect\DynamodbODM\Annotation\Types\Money;
use Autoprotect\DynamodbODM\Annotation\Types\StringType;
use Autoprotect\DynamodbODM\Model\Model;
class ExampleDemoModel extends Model
{
protected const TABLE_NAME = 'test-table';
#[StringType, Primary] protected string $id;
#[StringType] protected string $name;
#[FloatType] protected float $price;
#[Money] protected Money $priceNet;
#[FloatType] protected float $percent;
#[IntegerType] protected int $itemsAmount;
#[DateType] protected DateTime $createdAt;
#[BooleanType] protected bool $isDeleted;
#[BooleanType] protected bool $isPhoneNumber;
#[ModelType([ModelType::MODEL_CLASS_NAME => RelatedModel::class])]
protected RelatedModel $buyer;
#[CollectionType([CollectionType::MODEL_CLASS_NAME => RelatedModel::class])]
protected array $buyers;
#[ModelType([Asset::MODEL_CLASS_NAME => Asset::class])]
protected Asset $asset;
#[HashMapType([HashMapType::MODEL_CLASS_NAME => RelatedModel::class])]
protected array $buyersMap;
public function getId(): string
{
return $this->id;
}
public function setId(string $id): self
{
$this->id = $id;
return $this;
}
public function setAsset(Asset $asset): NewModel
{
$this->asset = $asset;
return $this;
}
public function getAsset()
{
return $this->asset;
}
public function setBuyer(RelatedModel $buyer): self
{
$this->buyer = $buyer;
return $this;
}
public function getBuyer(): RelatedModel
{
return $this->buyer;
}
public function setBuyers($buyers): self
{
$this->buyers = $buyers;
return $this;
}
public function getBuyers(): array
{
return $this->buyers;
}
public function setBuyersMap($buyersMap): self
{
$this->buyersMap = $buyersMap;
return $this;
}
public function getBuyersMap(): array
{
return $this->buyersMap;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function setPrice(float $price): self
{
$this->price = $price;
return $this;
}
public function setPriceNet(Money $priceNet): self
{
$this->priceNet = $priceNet;
return $this;
}
public function setPercent(float $percent): self
{
$this->percent = $percent;
return $this;
}
public function setItemsAmount(int $itemsAmount): self
{
$this->itemsAmount = $itemsAmount;
return $this;
}
public function getName()
{
return $this->name;
}
public function getPrice(): float
{
return $this->price;
}
public function getPriceNet(): Money
{
return $this->priceNet;
}
public function getPercent(): float
{
return $this->percent;
}
public function getItemsAmount(): int
{
return $this->itemsAmount;
}
public function getCreatedAt(): \DateTime
{
return $this->createdAt;
}
public function setCreatedAt(\DateTime $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getIsDeleted(): bool
{
return $this->isDeleted;
}
public function setIsDeleted(bool $isDeleted): self
{
$this->isDeleted = $isDeleted;
return $this;
}
public function getIsPhoneNumber(): bool
{
return $this->isPhoneNumber;
}
public function setIsPhoneNumber(bool $isPhoneNumber): self
{
$this->isPhoneNumber = $isPhoneNumber;
return $this;
}
}