1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Silverback API Components Bundle Project |
5
|
|
|
* |
6
|
|
|
* (c) Daniel West <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace Silverback\ApiComponentsBundle\Serializer\ResourceMetadata; |
15
|
|
|
|
16
|
|
|
use Silverback\ApiComponentsBundle\Metadata\PageDataMetadata; |
17
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
18
|
|
|
use Symfony\Component\Validator\ConstraintViolationListInterface; |
19
|
|
|
|
20
|
|
|
class ResourceMetadata implements ResourceMetadataInterface |
21
|
|
|
{ |
22
|
|
|
// for page data |
23
|
|
|
#[Groups('cwa_resource:metadata')] |
24
|
|
|
private ?PageDataMetadata $pageDataMetadata = null; |
25
|
|
|
|
26
|
|
|
// for component position |
27
|
|
|
#[Groups('cwa_resource:metadata')] |
28
|
|
|
private ?string $staticComponent = null; |
29
|
|
|
|
30
|
|
|
// for component position |
31
|
|
|
#[Groups('cwa_resource:metadata')] |
32
|
|
|
private ?string $pageDataPath = null; |
33
|
|
|
|
34
|
|
|
#[Groups('cwa_resource:metadata')] |
35
|
|
|
private ?bool $collection = null; |
36
|
|
|
|
37
|
|
|
#[Groups('cwa_resource:metadata')] |
38
|
|
|
private ?bool $persisted = null; |
39
|
|
|
|
40
|
|
|
#[Groups('cwa_resource:metadata')] |
41
|
|
|
private ?ResourcePublishableMetadata $publishable = null; |
42
|
|
|
|
43
|
|
|
#[Groups('cwa_resource:metadata')] |
44
|
|
|
private ?ConstraintViolationListInterface $violationList; |
45
|
|
|
|
46
|
|
|
#[Groups('cwa_resource:metadata')] |
47
|
|
|
private ?array $mediaObjects = null; |
48
|
|
|
|
49
|
|
|
public function getResourceMetadata(): ?ResourceMetadataInterface |
50
|
|
|
{ |
51
|
|
|
return $this; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getPageDataMetadata(): ?PageDataMetadata |
55
|
|
|
{ |
56
|
|
|
return $this->pageDataMetadata; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function setPageDataMetadata(PageDataMetadata $pageDataMetadata): void |
60
|
|
|
{ |
61
|
|
|
$this->pageDataMetadata = $pageDataMetadata; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function getStaticComponent(): ?string |
65
|
|
|
{ |
66
|
|
|
return $this->staticComponent; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function setStaticComponent(string $staticComponentIri): void |
70
|
|
|
{ |
71
|
|
|
$this->staticComponent = $staticComponentIri; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function getPageDataPath(): ?string |
75
|
|
|
{ |
76
|
|
|
return $this->pageDataPath; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function setPageDataPath(?string $pageDataPath): void |
80
|
|
|
{ |
81
|
|
|
$this->pageDataPath = $pageDataPath; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function getCollection(): ?bool |
85
|
|
|
{ |
86
|
|
|
return $this->collection; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function setCollection(bool $collection): void |
90
|
|
|
{ |
91
|
|
|
$this->collection = $collection; |
92
|
|
|
} |
93
|
|
|
|
94
|
1 |
|
public function getPersisted(): ?bool |
95
|
|
|
{ |
96
|
1 |
|
return $this->persisted; |
97
|
|
|
} |
98
|
|
|
|
99
|
1 |
|
public function setPersisted(?bool $persisted): void |
100
|
|
|
{ |
101
|
1 |
|
$this->persisted = $persisted; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function getPublishable(): ?ResourcePublishableMetadata |
105
|
|
|
{ |
106
|
|
|
return $this->publishable; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function setPublishable(bool $published, ?string $publishedAt = null): void |
110
|
|
|
{ |
111
|
|
|
if ($this->publishable) { |
112
|
|
|
$this->publishable->published = $published; |
113
|
|
|
$this->publishable->publishedAt = $publishedAt; |
114
|
|
|
|
115
|
|
|
return; |
116
|
|
|
} |
117
|
|
|
$this->publishable = new ResourcePublishableMetadata($published, $publishedAt); |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
public function getViolationList(): ?ConstraintViolationListInterface |
121
|
|
|
{ |
122
|
|
|
return $this->violationList; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
public function setViolationList(?ConstraintViolationListInterface $violationList): void |
126
|
|
|
{ |
127
|
|
|
$this->violationList = $violationList; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
public function getMediaObjects(): ?array |
131
|
|
|
{ |
132
|
|
|
return $this->mediaObjects; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
public function setMediaObjects(array $mediaObjects): void |
136
|
|
|
{ |
137
|
|
|
$this->mediaObjects = $mediaObjects; |
138
|
|
|
} |
139
|
|
|
} |
140
|
|
|
|