1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edm; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\CodeGeneration\AccessTypeTraits; |
6
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
7
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\Groups\TDerivableTypeAttributesTrait; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class representing TEntityTypeType |
11
|
|
|
* |
12
|
|
|
* |
13
|
|
|
* XSD Type: TEntityType |
14
|
|
|
*/ |
15
|
|
|
class TEntityTypeType extends IsOK |
16
|
|
|
{ |
17
|
|
|
use TDerivableTypeAttributesTrait, AccessTypeTraits; |
18
|
|
|
/** |
19
|
|
|
* @property boolean $openType |
20
|
|
|
*/ |
21
|
|
|
private $openType = false; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @property string $typeAccess |
25
|
|
|
*/ |
26
|
|
|
private $typeAccess = null; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation |
30
|
|
|
*/ |
31
|
|
|
private $documentation = null; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyRefType[] $key |
35
|
|
|
*/ |
36
|
|
|
private $key = null; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityPropertyType[] $property |
40
|
|
|
*/ |
41
|
|
|
private $property = []; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TNavigationPropertyType[] $navigationProperty |
45
|
|
|
*/ |
46
|
|
|
private $navigationProperty = []; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation |
50
|
|
|
*/ |
51
|
|
|
private $valueAnnotation = []; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation |
55
|
|
|
*/ |
56
|
|
|
private $typeAnnotation = []; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Gets as openType |
60
|
|
|
* |
61
|
|
|
* @return boolean |
62
|
|
|
*/ |
63
|
|
|
public function getOpenType() |
64
|
|
|
{ |
65
|
|
|
return $this->openType; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Sets a new openType |
70
|
|
|
* |
71
|
|
|
* @param boolean $openType |
72
|
|
|
* @return self |
73
|
|
|
*/ |
74
|
|
|
public function setOpenType($openType) |
75
|
|
|
{ |
76
|
|
|
$this->openType = $openType; |
77
|
|
|
return $this; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Gets as typeAccess |
82
|
|
|
* |
83
|
|
|
* @return string |
84
|
|
|
*/ |
85
|
|
|
public function getTypeAccess() |
86
|
|
|
{ |
87
|
|
|
return $this->typeAccess; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Sets a new typeAccess |
92
|
|
|
* |
93
|
|
|
* @param string $typeAccess |
94
|
|
|
* @return self |
95
|
|
|
*/ |
96
|
|
|
public function setTypeAccess($typeAccess) |
97
|
|
|
{ |
98
|
|
|
$this->typeAccess = $typeAccess; |
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Gets as documentation |
104
|
|
|
* |
105
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType |
106
|
|
|
*/ |
107
|
|
|
public function getDocumentation() |
108
|
|
|
{ |
109
|
|
|
return $this->documentation; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Sets a new documentation |
114
|
|
|
* |
115
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation |
116
|
|
|
* @return self |
117
|
|
|
*/ |
118
|
|
|
public function setDocumentation(TDocumentationType $documentation) |
119
|
|
|
{ |
120
|
|
|
$this->documentation = $documentation; |
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Adds as propertyRef |
126
|
|
|
* |
127
|
|
|
* @return self |
128
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyRefType $propertyRef |
129
|
|
|
*/ |
130
|
|
|
public function addToKey(TPropertyRefType $propertyRef) |
131
|
|
|
{ |
132
|
|
|
$this->key[] = $propertyRef; |
133
|
|
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* isset key |
138
|
|
|
* |
139
|
|
|
* @param scalar $index |
140
|
|
|
* @return boolean |
141
|
|
|
*/ |
142
|
|
|
public function issetKey($index) |
143
|
|
|
{ |
144
|
|
|
return isset($this->key[$index]); |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* unset key |
149
|
|
|
* |
150
|
|
|
* @param scalar $index |
151
|
|
|
* @return void |
152
|
|
|
*/ |
153
|
|
|
public function unsetKey($index) |
154
|
|
|
{ |
155
|
|
|
unset($this->key[$index]); |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Gets as key |
160
|
|
|
* |
161
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyRefType[] |
162
|
|
|
*/ |
163
|
|
|
public function getKey() |
164
|
|
|
{ |
165
|
|
|
return $this->key; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* Sets a new key |
170
|
|
|
* |
171
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyRefType[] $key |
172
|
|
|
* @return self |
173
|
|
|
*/ |
174
|
|
|
public function setKey(array $key) |
175
|
|
|
{ |
176
|
|
|
$this->key = $key; |
177
|
|
|
return $this; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* Adds as property |
182
|
|
|
* |
183
|
|
|
* @return self |
184
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityPropertyType $property |
185
|
|
|
*/ |
186
|
|
|
public function addToProperty(TEntityPropertyType $property) |
187
|
|
|
{ |
188
|
|
|
$this->property[] = $property; |
189
|
|
|
return $this; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* isset property |
194
|
|
|
* |
195
|
|
|
* @param scalar $index |
196
|
|
|
* @return boolean |
197
|
|
|
*/ |
198
|
|
|
public function issetProperty($index) |
199
|
|
|
{ |
200
|
|
|
return isset($this->property[$index]); |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* unset property |
205
|
|
|
* |
206
|
|
|
* @param scalar $index |
207
|
|
|
* @return void |
208
|
|
|
*/ |
209
|
|
|
public function unsetProperty($index) |
210
|
|
|
{ |
211
|
|
|
unset($this->property[$index]); |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Gets as property |
216
|
|
|
* |
217
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityPropertyType[] |
218
|
|
|
*/ |
219
|
|
|
public function getProperty() |
220
|
|
|
{ |
221
|
|
|
return $this->property; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* Sets a new property |
226
|
|
|
* |
227
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityPropertyType[] $property |
228
|
|
|
* @return self |
229
|
|
|
*/ |
230
|
|
|
public function setProperty(array $property) |
231
|
|
|
{ |
232
|
|
|
$this->property = $property; |
233
|
|
|
return $this; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* Adds as navigationProperty |
238
|
|
|
* |
239
|
|
|
* @return self |
240
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TNavigationPropertyType $navigationProperty |
241
|
|
|
*/ |
242
|
|
|
public function addToNavigationProperty(TNavigationPropertyType $navigationProperty) |
243
|
|
|
{ |
244
|
|
|
$this->navigationProperty[] = $navigationProperty; |
245
|
|
|
return $this; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* isset navigationProperty |
250
|
|
|
* |
251
|
|
|
* @param scalar $index |
252
|
|
|
* @return boolean |
253
|
|
|
*/ |
254
|
|
|
public function issetNavigationProperty($index) |
255
|
|
|
{ |
256
|
|
|
return isset($this->navigationProperty[$index]); |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* unset navigationProperty |
261
|
|
|
* |
262
|
|
|
* @param scalar $index |
263
|
|
|
* @return void |
264
|
|
|
*/ |
265
|
|
|
public function unsetNavigationProperty($index) |
266
|
|
|
{ |
267
|
|
|
unset($this->navigationProperty[$index]); |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* Gets as navigationProperty |
272
|
|
|
* |
273
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TNavigationPropertyType[] |
274
|
|
|
*/ |
275
|
|
|
public function getNavigationProperty() |
276
|
|
|
{ |
277
|
|
|
return $this->navigationProperty; |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* Sets a new navigationProperty |
282
|
|
|
* |
283
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TNavigationPropertyType[] $navigationProperty |
284
|
|
|
* @return self |
285
|
|
|
*/ |
286
|
|
|
public function setNavigationProperty(array $navigationProperty) |
287
|
|
|
{ |
288
|
|
|
$this->navigationProperty = $navigationProperty; |
289
|
|
|
return $this; |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
/** |
293
|
|
|
* Adds as valueAnnotation |
294
|
|
|
* |
295
|
|
|
* @return self |
296
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType $valueAnnotation |
297
|
|
|
*/ |
298
|
|
|
public function addToValueAnnotation(TValueAnnotationType $valueAnnotation) |
299
|
|
|
{ |
300
|
|
|
$this->valueAnnotation[] = $valueAnnotation; |
301
|
|
|
return $this; |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
/** |
305
|
|
|
* isset valueAnnotation |
306
|
|
|
* |
307
|
|
|
* @param scalar $index |
308
|
|
|
* @return boolean |
309
|
|
|
*/ |
310
|
|
|
public function issetValueAnnotation($index) |
311
|
|
|
{ |
312
|
|
|
return isset($this->valueAnnotation[$index]); |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* unset valueAnnotation |
317
|
|
|
* |
318
|
|
|
* @param scalar $index |
319
|
|
|
* @return void |
320
|
|
|
*/ |
321
|
|
|
public function unsetValueAnnotation($index) |
322
|
|
|
{ |
323
|
|
|
unset($this->valueAnnotation[$index]); |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
/** |
327
|
|
|
* Gets as valueAnnotation |
328
|
|
|
* |
329
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] |
330
|
|
|
*/ |
331
|
|
|
public function getValueAnnotation() |
332
|
|
|
{ |
333
|
|
|
return $this->valueAnnotation; |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
/** |
337
|
|
|
* Sets a new valueAnnotation |
338
|
|
|
* |
339
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation |
340
|
|
|
* @return self |
341
|
|
|
*/ |
342
|
|
|
public function setValueAnnotation(array $valueAnnotation) |
343
|
|
|
{ |
344
|
|
|
$this->valueAnnotation = $valueAnnotation; |
345
|
|
|
return $this; |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
/** |
349
|
|
|
* Adds as typeAnnotation |
350
|
|
|
* |
351
|
|
|
* @return self |
352
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType $typeAnnotation |
353
|
|
|
*/ |
354
|
|
|
public function addToTypeAnnotation(TTypeAnnotationType $typeAnnotation) |
355
|
|
|
{ |
356
|
|
|
$this->typeAnnotation[] = $typeAnnotation; |
357
|
|
|
return $this; |
358
|
|
|
} |
359
|
|
|
|
360
|
|
|
/** |
361
|
|
|
* isset typeAnnotation |
362
|
|
|
* |
363
|
|
|
* @param scalar $index |
364
|
|
|
* @return boolean |
365
|
|
|
*/ |
366
|
|
|
public function issetTypeAnnotation($index) |
367
|
|
|
{ |
368
|
|
|
return isset($this->typeAnnotation[$index]); |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* unset typeAnnotation |
373
|
|
|
* |
374
|
|
|
* @param scalar $index |
375
|
|
|
* @return void |
376
|
|
|
*/ |
377
|
|
|
public function unsetTypeAnnotation($index) |
378
|
|
|
{ |
379
|
|
|
unset($this->typeAnnotation[$index]); |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* Gets as typeAnnotation |
384
|
|
|
* |
385
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] |
386
|
|
|
*/ |
387
|
|
|
public function getTypeAnnotation() |
388
|
|
|
{ |
389
|
|
|
return $this->typeAnnotation; |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
/** |
393
|
|
|
* Sets a new typeAnnotation |
394
|
|
|
* |
395
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation |
396
|
|
|
* @return self |
397
|
|
|
*/ |
398
|
|
|
public function setTypeAnnotation(array $typeAnnotation) |
399
|
|
|
{ |
400
|
|
|
$this->typeAnnotation = $typeAnnotation; |
401
|
|
|
return $this; |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
public function isOK(&$msg = null) |
405
|
|
|
{ |
406
|
|
|
if (!$this->isTPublicOrInternalAccessOK($this->typeAccess)) { |
407
|
|
|
$msg = "Type access must be Public or Internal"; |
408
|
|
|
return false; |
409
|
|
|
} |
410
|
|
|
if (!$this->isObjectNullOrOK($this->documentation, $msg)) { |
411
|
|
|
return false; |
412
|
|
|
} |
413
|
|
|
if (!$this->isValidArrayOK( |
414
|
|
|
$this->key, |
415
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyRefType', |
416
|
|
|
$msg |
417
|
|
|
)) { |
418
|
|
|
return false; |
419
|
|
|
} |
420
|
|
|
|
421
|
|
|
if (!$this->isValidArrayOK( |
422
|
|
|
$this->property, |
423
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityPropertyType', |
424
|
|
|
$msg |
425
|
|
|
)) { |
426
|
|
|
return false; |
427
|
|
|
} |
428
|
|
|
if (!$this->isValidArrayOK( |
429
|
|
|
$this->navigationProperty, |
430
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\TNavigationPropertyType', |
431
|
|
|
$msg |
432
|
|
|
)) { |
433
|
|
|
return false; |
434
|
|
|
} |
435
|
|
|
if (!$this->isValidArrayOK( |
436
|
|
|
$this->valueAnnotation, |
437
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType', |
438
|
|
|
$msg |
439
|
|
|
)) { |
440
|
|
|
return false; |
441
|
|
|
} |
442
|
|
|
if (!$this->isValidArrayOK( |
443
|
|
|
$this->typeAnnotation, |
444
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType', |
445
|
|
|
$msg |
446
|
|
|
)) { |
447
|
|
|
return false; |
448
|
|
|
} |
449
|
|
|
if (!$this->isTDerivableTypeAttributesValid($msg)) { |
450
|
|
|
return false; |
451
|
|
|
} |
452
|
|
|
return true; |
453
|
|
|
} |
454
|
|
|
} |
455
|
|
|
|