Skip to content

Commit db5fbf2

Browse files
authored
DATCAP-481: adding ref_availability_mabel entity
1 parent f49ad6f commit db5fbf2

File tree

1 file changed

+192
-0
lines changed

1 file changed

+192
-0
lines changed
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
<?php
2+
3+
namespace BBC\ProgrammesPagesService\Data\ProgrammesDb\Entity;
4+
5+
use BBC\ProgrammesPagesService\Domain\Enumeration\AvailabilityStatusEnum;
6+
use DateTime;
7+
use Doctrine\ORM\Mapping as ORM;
8+
use Gedmo\Timestampable\Traits\TimestampableEntity;
9+
use InvalidArgumentException;
10+
11+
/**
12+
* @ORM\Entity()
13+
*/
14+
class RefAvailabilityMabel
15+
{
16+
use TimestampableEntity;
17+
18+
/**
19+
* @var int|null
20+
*
21+
* @ORM\Id()
22+
* @ORM\Column(type="integer", nullable=false)
23+
* @ORM\GeneratedValue(strategy="AUTO")
24+
*/
25+
private $id;
26+
27+
/**
28+
* @var string
29+
*
30+
* @ORM\Column(type="string", length=32, nullable=false)
31+
*/
32+
private $status = AvailabilityStatusEnum::PENDING;
33+
34+
/**
35+
* @var string
36+
*
37+
* @ORM\Column(type="string", length=64, nullable=false)
38+
*/
39+
private $type;
40+
41+
/**
42+
* @var Version
43+
*
44+
* @ORM\ManyToOne(targetEntity="Version")
45+
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
46+
*/
47+
private $version;
48+
49+
/**
50+
* @var ProgrammeItem
51+
*
52+
* @ORM\ManyToOne(targetEntity="ProgrammeItem")
53+
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
54+
*/
55+
private $programmeItem;
56+
57+
/**
58+
* @var RefMediaSet
59+
*
60+
* @ORM\ManyToOne(targetEntity="RefMediaSet")
61+
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
62+
*/
63+
private $mediaSet;
64+
65+
/**
66+
* @var DateTime
67+
*
68+
* @ORM\Column(type="datetime", nullable=false)
69+
*/
70+
private $scheduledStart;
71+
72+
/**
73+
* @var DateTime|null
74+
*
75+
* @ORM\Column(type="datetime", nullable=true)
76+
*/
77+
private $scheduledEnd;
78+
79+
/**
80+
* @var DateTime|null
81+
*
82+
* @ORM\Column(type="datetime", nullable=true)
83+
*/
84+
private $actualStart;
85+
86+
public function __construct(
87+
string $type,
88+
Version $version,
89+
ProgrammeItem $programmeItem,
90+
RefMediaSet $mediaSet,
91+
DateTime $scheduledStart
92+
) {
93+
$this->type = $type;
94+
$this->version = $version;
95+
$this->programmeItem = $programmeItem;
96+
$this->mediaSet = $mediaSet;
97+
$this->scheduledStart = $scheduledStart;
98+
}
99+
100+
public function getId(): ?int
101+
{
102+
return $this->id;
103+
}
104+
105+
public function getType(): string
106+
{
107+
return $this->type;
108+
}
109+
110+
public function setType(string $type): void
111+
{
112+
$this->type = $type;
113+
}
114+
115+
public function getVersion(): Version
116+
{
117+
return $this->version;
118+
}
119+
120+
public function setVersion(Version $version): void
121+
{
122+
$this->version = $version;
123+
}
124+
125+
public function getProgrammeItem(): ProgrammeItem
126+
{
127+
return $this->programmeItem;
128+
}
129+
130+
public function setProgrammeItem(ProgrammeItem $programmeItem): void
131+
{
132+
$this->programmeItem = $programmeItem;
133+
}
134+
135+
public function getMediaSet(): RefMediaSet
136+
{
137+
return $this->mediaSet;
138+
}
139+
140+
public function setMediaSet(RefMediaSet $mediaSet): void
141+
{
142+
$this->mediaSet = $mediaSet;
143+
}
144+
145+
public function getScheduledStart(): DateTime
146+
{
147+
return $this->scheduledStart;
148+
}
149+
150+
public function setScheduledStart(DateTime $scheduledStart): void
151+
{
152+
$this->scheduledStart = $scheduledStart;
153+
}
154+
155+
public function getScheduledEnd(): ?DateTime
156+
{
157+
return $this->scheduledEnd;
158+
}
159+
160+
public function setScheduledEnd(?DateTime $scheduledEnd): void
161+
{
162+
$this->scheduledEnd = $scheduledEnd;
163+
}
164+
165+
public function getActualStart(): ?DateTime
166+
{
167+
return $this->actualStart;
168+
}
169+
170+
public function setActualStart(?DateTime $actualStart): void
171+
{
172+
$this->actualStart = $actualStart;
173+
}
174+
175+
public function getStatus(): string
176+
{
177+
return $this->status;
178+
}
179+
180+
public function setStatus(string $status): void
181+
{
182+
if (!in_array($status, AvailabilityStatusEnum::validValues())) {
183+
throw new InvalidArgumentException(sprintf(
184+
'Called setStatus with an invalid value. Expected one of %s but got "%s"',
185+
'"' . implode('", "', AvailabilityStatusEnum::validValues()) . '"',
186+
$status
187+
));
188+
}
189+
190+
$this->status = $status;
191+
}
192+
}

0 commit comments

Comments
 (0)