Skip to content

Commit 20ea89e

Browse files
committed
Example Entity ‘ItemType’
1 parent 2332783 commit 20ea89e

1 file changed

Lines changed: 192 additions & 0 deletions

File tree

src/Entity/ItemType.php

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
<?php declare(strict_types=1);
2+
3+
4+
namespace App\Entity;
5+
6+
use Doctrine\ORM\Mapping as ORM;
7+
use Ramsey\Uuid\Uuid;
8+
use Ramsey\Uuid\UuidInterface;
9+
10+
/**
11+
* @ORM\Entity
12+
*/
13+
class ItemType
14+
{
15+
/**
16+
* @var UuidInterface
17+
*
18+
* @ORM\Id
19+
* @ORM\Column(type="uuid", unique=true)
20+
*/
21+
protected $id;
22+
23+
/**
24+
* @var string
25+
* @ORM\Column(type="string", length=255)
26+
*/
27+
protected $commonName;
28+
29+
/**
30+
* @var string|null
31+
* @ORM\Column(type="string", length=1023, nullable=true)
32+
*/
33+
protected $officialName;
34+
35+
/**
36+
* @var int|null
37+
* @ORM\Column(type="integer", nullable=true)
38+
*/
39+
protected $basicRentalPrice;
40+
41+
/**
42+
* @var string|null
43+
* @ORM\Column(type="string", nullable=true)
44+
*/
45+
protected $productPageUrl;
46+
47+
/**
48+
* @var string|null
49+
* @TODO How to handle files
50+
* @ORM\Column(type="string", nullable=true)
51+
*/
52+
protected $avatar;
53+
54+
/**
55+
* @var string[]
56+
* @TODO How to handle files
57+
* @ORM\Column(type="json_array", nullable=true)
58+
*/
59+
protected $attachments;
60+
61+
/**
62+
* Weight in grams.
63+
*
64+
* @var int|null
65+
* @ORM\Column(type="integer", nullable=true)
66+
*/
67+
protected $weight;
68+
69+
/**
70+
* ItemType constructor.
71+
*
72+
* @param string $commonName
73+
*/
74+
public function __construct(string $commonName)
75+
{
76+
$this->commonName = $commonName;
77+
$this->id = Uuid::uuid4();
78+
}
79+
80+
/**
81+
* @return string
82+
*/
83+
public function getCommonName(): string
84+
{
85+
return $this->commonName;
86+
}
87+
88+
/**
89+
* @param string $commonName
90+
*/
91+
public function setCommonName(string $commonName): void
92+
{
93+
$this->commonName = $commonName;
94+
}
95+
96+
/**
97+
* @return null|string
98+
*/
99+
public function getOfficialName(): ?string
100+
{
101+
return $this->officialName;
102+
}
103+
104+
/**
105+
* @param null|string $officialName
106+
*/
107+
public function setOfficialName(?string $officialName): void
108+
{
109+
$this->officialName = $officialName;
110+
}
111+
112+
/**
113+
* @return int|null
114+
*/
115+
public function getBasicRentalPrice(): ?int
116+
{
117+
return $this->basicRentalPrice;
118+
}
119+
120+
/**
121+
* @param int|null $basicRentalPrice
122+
*/
123+
public function setBasicRentalPrice(?int $basicRentalPrice): void
124+
{
125+
$this->basicRentalPrice = $basicRentalPrice;
126+
}
127+
128+
/**
129+
* @return null|string
130+
*/
131+
public function getProductPageUrl(): ?string
132+
{
133+
return $this->productPageUrl;
134+
}
135+
136+
/**
137+
* @param null|string $productPageUrl
138+
*/
139+
public function setProductPageUrl(?string $productPageUrl): void
140+
{
141+
$this->productPageUrl = $productPageUrl;
142+
}
143+
144+
/**
145+
* @return null|string
146+
*/
147+
public function getAvatar(): ?string
148+
{
149+
return $this->avatar;
150+
}
151+
152+
/**
153+
* @param null|string $avatar
154+
*/
155+
public function setAvatar(?string $avatar): void
156+
{
157+
$this->avatar = $avatar;
158+
}
159+
160+
/**
161+
* @return string[]
162+
*/
163+
public function getAttachments(): array
164+
{
165+
return $this->attachments;
166+
}
167+
168+
/**
169+
* @param string[] $attachments
170+
*/
171+
public function setAttachments(array $attachments): void
172+
{
173+
$this->attachments = $attachments;
174+
}
175+
176+
/**
177+
* @return int|null
178+
*/
179+
public function getWeight(): ?int
180+
{
181+
return $this->weight;
182+
}
183+
184+
/**
185+
* @param int|null $weight
186+
*/
187+
public function setWeight(?int $weight): void
188+
{
189+
$this->weight = $weight;
190+
}
191+
192+
}

0 commit comments

Comments
 (0)