1
|
|
|
<?php |
2
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl; |
3
|
|
|
|
4
|
|
|
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait; |
5
|
|
|
|
6
|
|
|
trait GSchemaBodyElementsTrait |
7
|
|
|
{ |
8
|
|
|
use IsOKToolboxTrait; |
9
|
|
|
/** |
10
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TAssociationType[] $association |
11
|
|
|
*/ |
12
|
|
|
private $association = []; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TEntityTypeType[] $entityType |
16
|
|
|
*/ |
17
|
|
|
private $entityType = []; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\EntityContainer[] $entityContainer |
21
|
|
|
*/ |
22
|
|
|
private $entityContainer = []; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionType[] $function |
26
|
|
|
*/ |
27
|
|
|
private $function = []; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Adds as association |
31
|
|
|
* |
32
|
|
|
* @return self |
33
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TAssociationType $association |
34
|
|
|
*/ |
35
|
|
|
public function addToAssociation(TAssociationType $association) |
36
|
|
|
{ |
37
|
|
|
$this->association[] = $association; |
38
|
|
|
return $this; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* isset association |
43
|
|
|
* |
44
|
|
|
* @param scalar $index |
45
|
|
|
* @return boolean |
46
|
|
|
*/ |
47
|
|
|
public function issetAssociation($index) |
48
|
|
|
{ |
49
|
|
|
return isset($this->association[$index]); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* unset association |
54
|
|
|
* |
55
|
|
|
* @param scalar $index |
56
|
|
|
* @return void |
57
|
|
|
*/ |
58
|
|
|
public function unsetAssociation($index) |
59
|
|
|
{ |
60
|
|
|
unset($this->association[$index]); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Gets as association |
65
|
|
|
* |
66
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TAssociationType[] |
67
|
|
|
*/ |
68
|
|
|
public function getAssociation() |
69
|
|
|
{ |
70
|
|
|
return $this->association; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Sets a new association |
75
|
|
|
* |
76
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TAssociationType[] $association |
77
|
|
|
* @return self |
78
|
|
|
*/ |
79
|
|
|
public function setAssociation(array $association) |
80
|
|
|
{ |
81
|
|
|
$this->association = $association; |
82
|
|
|
return $this; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Adds as entityType |
87
|
|
|
* |
88
|
|
|
* @return self |
89
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TEntityTypeType $entityType |
90
|
|
|
*/ |
91
|
|
|
public function addToEntityType(TEntityTypeType $entityType) |
92
|
|
|
{ |
93
|
|
|
$this->entityType[] = $entityType; |
94
|
|
|
return $this; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* isset entityType |
99
|
|
|
* |
100
|
|
|
* @param scalar $index |
101
|
|
|
* @return boolean |
102
|
|
|
*/ |
103
|
|
|
public function issetEntityType($index) |
104
|
|
|
{ |
105
|
|
|
return isset($this->entityType[$index]); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* unset entityType |
110
|
|
|
* |
111
|
|
|
* @param scalar $index |
112
|
|
|
* @return void |
113
|
|
|
*/ |
114
|
|
|
public function unsetEntityType($index) |
115
|
|
|
{ |
116
|
|
|
unset($this->entityType[$index]); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Gets as entityType |
121
|
|
|
* |
122
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TEntityTypeType[] |
123
|
|
|
*/ |
124
|
|
|
public function getEntityType() |
125
|
|
|
{ |
126
|
|
|
return $this->entityType; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Sets a new entityType |
131
|
|
|
* |
132
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TEntityTypeType[] $entityType |
133
|
|
|
* @return self |
134
|
|
|
*/ |
135
|
|
|
public function setEntityType(array $entityType) |
136
|
|
|
{ |
137
|
|
|
$this->entityType = $entityType; |
138
|
|
|
return $this; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Adds as entityContainer |
143
|
|
|
* |
144
|
|
|
* @return self |
145
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\EntityContainer $entityContainer |
146
|
|
|
*/ |
147
|
|
|
public function addToEntityContainer(EntityContainer $entityContainer) |
148
|
|
|
{ |
149
|
|
|
$this->entityContainer[] = $entityContainer; |
150
|
|
|
return $this; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* isset entityContainer |
155
|
|
|
* |
156
|
|
|
* @param scalar $index |
157
|
|
|
* @return boolean |
158
|
|
|
*/ |
159
|
|
|
public function issetEntityContainer($index) |
160
|
|
|
{ |
161
|
|
|
return isset($this->entityContainer[$index]); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* unset entityContainer |
166
|
|
|
* |
167
|
|
|
* @param scalar $index |
168
|
|
|
* @return void |
169
|
|
|
*/ |
170
|
|
|
public function unsetEntityContainer($index) |
171
|
|
|
{ |
172
|
|
|
unset($this->entityContainer[$index]); |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* Gets as entityContainer |
177
|
|
|
* |
178
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\EntityContainer[] |
179
|
|
|
*/ |
180
|
|
|
public function getEntityContainer() |
181
|
|
|
{ |
182
|
|
|
return $this->entityContainer; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* Sets a new entityContainer |
187
|
|
|
* |
188
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\EntityContainer[] $entityContainer |
189
|
|
|
* @return self |
190
|
|
|
*/ |
191
|
|
|
public function setEntityContainer(array $entityContainer) |
192
|
|
|
{ |
193
|
|
|
$this->entityContainer = $entityContainer; |
194
|
|
|
return $this; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* Adds as function |
199
|
|
|
* |
200
|
|
|
* @return self |
201
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionType $function |
202
|
|
|
*/ |
203
|
|
|
public function addToFunction(TFunctionType $function) |
204
|
|
|
{ |
205
|
|
|
$this->function[] = $function; |
206
|
|
|
return $this; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* isset function |
211
|
|
|
* |
212
|
|
|
* @param scalar $index |
213
|
|
|
* @return boolean |
214
|
|
|
*/ |
215
|
|
|
public function issetFunction($index) |
216
|
|
|
{ |
217
|
|
|
return isset($this->function[$index]); |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* unset function |
222
|
|
|
* |
223
|
|
|
* @param scalar $index |
224
|
|
|
* @return void |
225
|
|
|
*/ |
226
|
|
|
public function unsetFunction($index) |
227
|
|
|
{ |
228
|
|
|
unset($this->function[$index]); |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* Gets as function |
233
|
|
|
* |
234
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionType[] |
235
|
|
|
*/ |
236
|
|
|
public function getFunction() |
237
|
|
|
{ |
238
|
|
|
return $this->function; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* Sets a new function |
243
|
|
|
* |
244
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionType[] $function |
245
|
|
|
* @return self |
246
|
|
|
*/ |
247
|
|
|
public function setFunction(array $function) |
248
|
|
|
{ |
249
|
|
|
$this->function = $function; |
250
|
|
|
return $this; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
public function isBodyElementsOK(&$msg = null) |
254
|
|
|
{ |
255
|
|
|
if (!$this->isValidArrayOK( |
256
|
|
|
$this->association, |
257
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TAssociationType', |
258
|
|
|
$msg |
259
|
|
|
)) { |
260
|
|
|
return false; |
261
|
|
|
} |
262
|
|
|
if (!$this->isValidArrayOK( |
263
|
|
|
$this->entityType, |
264
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TEntityTypeType', |
265
|
|
|
$msg |
266
|
|
|
)) { |
267
|
|
|
return false; |
268
|
|
|
} |
269
|
|
|
if (!$this->isValidArrayOK( |
270
|
|
|
$this->entityContainer, |
271
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\EntityContainer', |
272
|
|
|
$msg, |
273
|
|
|
1 |
274
|
|
|
)) { |
275
|
|
|
return false; |
276
|
|
|
} |
277
|
|
|
if (!$this->isValidArrayOK( |
278
|
|
|
$this->function, |
279
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionType', |
280
|
|
|
$msg |
281
|
|
|
)) { |
282
|
|
|
return false; |
283
|
|
|
} |
284
|
|
|
return true; |
285
|
|
|
} |
286
|
|
|
} |
287
|
|
|
|