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\IsOKTraits\IsOKToolboxTrait; |
8
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType; |
9
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType; |
10
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType; |
11
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class representing EntityContainer |
15
|
|
|
*/ |
16
|
|
|
class EntityContainer extends IsOK |
17
|
|
|
{ |
18
|
|
|
use IsOKToolboxTrait, TSimpleIdentifierTrait, AccessTypeTraits; |
19
|
|
|
/** |
20
|
|
|
* @property string $name |
21
|
|
|
*/ |
22
|
|
|
private $name = null; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @property string $extends |
26
|
|
|
*/ |
27
|
|
|
private $extends = null; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @property string $typeAccess |
31
|
|
|
*/ |
32
|
|
|
private $typeAccess = null; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @property boolean $lazyLoadingEnabled |
36
|
|
|
*/ |
37
|
|
|
private $lazyLoadingEnabled = null; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation |
41
|
|
|
*/ |
42
|
|
|
private $documentation = null; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType[] |
46
|
|
|
* $functionImport |
47
|
|
|
*/ |
48
|
|
|
private $functionImport = []; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType[] $entitySet |
52
|
|
|
*/ |
53
|
|
|
private $entitySet = []; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType[] |
57
|
|
|
* $associationSet |
58
|
|
|
*/ |
59
|
|
|
private $associationSet = []; |
60
|
|
|
|
61
|
|
|
public function __construct($name = "DefaultContainer") |
62
|
|
|
{ |
63
|
|
|
$this->setName($name); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Gets as name |
68
|
|
|
* |
69
|
|
|
* @return string |
70
|
|
|
*/ |
71
|
|
|
public function getName() |
72
|
|
|
{ |
73
|
|
|
return $this->name; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Sets a new name |
78
|
|
|
* |
79
|
|
|
* @param string $name |
80
|
|
|
* @return self |
81
|
|
|
*/ |
82
|
|
|
public function setName($name) |
83
|
|
|
{ |
84
|
|
|
$this->name = $name; |
85
|
|
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Gets as extends |
90
|
|
|
* |
91
|
|
|
* @return string |
92
|
|
|
*/ |
93
|
|
|
public function getExtends() |
94
|
|
|
{ |
95
|
|
|
return $this->extends; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Sets a new extends |
100
|
|
|
* |
101
|
|
|
* @param string $extends |
102
|
|
|
* @return self |
103
|
|
|
*/ |
104
|
|
|
public function setExtends($extends) |
105
|
|
|
{ |
106
|
|
|
$this->extends = $extends; |
107
|
|
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Gets as typeAccess |
112
|
|
|
* |
113
|
|
|
* @return string |
114
|
|
|
*/ |
115
|
|
|
public function getTypeAccess() |
116
|
|
|
{ |
117
|
|
|
return $this->typeAccess; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* Sets a new typeAccess |
122
|
|
|
* |
123
|
|
|
* @param string $typeAccess |
124
|
|
|
* @return self |
125
|
|
|
*/ |
126
|
|
|
public function setTypeAccess($typeAccess) |
127
|
|
|
{ |
128
|
|
|
$this->typeAccess = $typeAccess; |
129
|
|
|
return $this; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Gets as lazyLoadingEnabled |
134
|
|
|
* |
135
|
|
|
* @return boolean |
136
|
|
|
*/ |
137
|
|
|
public function getLazyLoadingEnabled() |
138
|
|
|
{ |
139
|
|
|
return $this->lazyLoadingEnabled; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Sets a new lazyLoadingEnabled |
144
|
|
|
* |
145
|
|
|
* @param boolean $lazyLoadingEnabled |
146
|
|
|
* @return self |
147
|
|
|
*/ |
148
|
|
|
public function setLazyLoadingEnabled($lazyLoadingEnabled) |
149
|
|
|
{ |
150
|
|
|
$this->lazyLoadingEnabled = $lazyLoadingEnabled; |
151
|
|
|
return $this; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Gets as documentation |
156
|
|
|
* |
157
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType |
158
|
|
|
*/ |
159
|
|
|
public function getDocumentation() |
160
|
|
|
{ |
161
|
|
|
return $this->documentation; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Sets a new documentation |
166
|
|
|
* |
167
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation |
168
|
|
|
* @return self |
169
|
|
|
*/ |
170
|
|
|
public function setDocumentation(TDocumentationType $documentation) |
171
|
|
|
{ |
172
|
|
|
$this->documentation = $documentation; |
173
|
|
|
return $this; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Adds as functionImport |
178
|
|
|
* |
179
|
|
|
* @return self |
180
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType |
181
|
|
|
* $functionImport |
182
|
|
|
*/ |
183
|
|
|
public function addToFunctionImport(FunctionImportAnonymousType $functionImport) |
184
|
|
|
{ |
185
|
|
|
$this->functionImport[] = $functionImport; |
186
|
|
|
return $this; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* isset functionImport |
191
|
|
|
* |
192
|
|
|
* @param scalar $index |
193
|
|
|
* @return boolean |
194
|
|
|
*/ |
195
|
|
|
public function issetFunctionImport($index) |
196
|
|
|
{ |
197
|
|
|
return isset($this->functionImport[$index]); |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* unset functionImport |
202
|
|
|
* |
203
|
|
|
* @param scalar $index |
204
|
|
|
* @return void |
205
|
|
|
*/ |
206
|
|
|
public function unsetFunctionImport($index) |
207
|
|
|
{ |
208
|
|
|
unset($this->functionImport[$index]); |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* Gets as functionImport |
213
|
|
|
* |
214
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType[] |
215
|
|
|
*/ |
216
|
|
|
public function getFunctionImport() |
217
|
|
|
{ |
218
|
|
|
return $this->functionImport; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* Sets a new functionImport |
223
|
|
|
* |
224
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType[] |
225
|
|
|
* $functionImport |
226
|
|
|
* @return self |
227
|
|
|
*/ |
228
|
|
|
public function setFunctionImport(array $functionImport) |
229
|
|
|
{ |
230
|
|
|
$this->functionImport = $functionImport; |
231
|
|
|
return $this; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* Adds as entitySet |
236
|
|
|
* |
237
|
|
|
* @return self |
238
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType $entitySet |
239
|
|
|
*/ |
240
|
|
|
public function addToEntitySet(EntitySetAnonymousType $entitySet) |
241
|
|
|
{ |
242
|
|
|
$this->entitySet[] = $entitySet; |
243
|
|
|
return $this; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* isset entitySet |
248
|
|
|
* |
249
|
|
|
* @param scalar $index |
250
|
|
|
* @return boolean |
251
|
|
|
*/ |
252
|
|
|
public function issetEntitySet($index) |
253
|
|
|
{ |
254
|
|
|
return isset($this->entitySet[$index]); |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* unset entitySet |
259
|
|
|
* |
260
|
|
|
* @param scalar $index |
261
|
|
|
* @return void |
262
|
|
|
*/ |
263
|
|
|
public function unsetEntitySet($index) |
264
|
|
|
{ |
265
|
|
|
unset($this->entitySet[$index]); |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* Gets as entitySet |
270
|
|
|
* |
271
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType[] |
272
|
|
|
*/ |
273
|
|
|
public function getEntitySet() |
274
|
|
|
{ |
275
|
|
|
return $this->entitySet; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* Sets a new entitySet |
280
|
|
|
* |
281
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType[] $entitySet |
282
|
|
|
* @return self |
283
|
|
|
*/ |
284
|
|
|
public function setEntitySet(array $entitySet) |
285
|
|
|
{ |
286
|
|
|
$this->entitySet = $entitySet; |
287
|
|
|
return $this; |
288
|
|
|
} |
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* Adds as associationSet |
292
|
|
|
* |
293
|
|
|
* @return self |
294
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType |
295
|
|
|
* $associationSet |
296
|
|
|
*/ |
297
|
|
|
public function addToAssociationSet(AssociationSetAnonymousType $associationSet) |
298
|
|
|
{ |
299
|
|
|
$this->associationSet[] = $associationSet; |
300
|
|
|
return $this; |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
/** |
304
|
|
|
* isset associationSet |
305
|
|
|
* |
306
|
|
|
* @param scalar $index |
307
|
|
|
* @return boolean |
308
|
|
|
*/ |
309
|
|
|
public function issetAssociationSet($index) |
310
|
|
|
{ |
311
|
|
|
return isset($this->associationSet[$index]); |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
/** |
315
|
|
|
* unset associationSet |
316
|
|
|
* |
317
|
|
|
* @param scalar $index |
318
|
|
|
* @return void |
319
|
|
|
*/ |
320
|
|
|
public function unsetAssociationSet($index) |
321
|
|
|
{ |
322
|
|
|
unset($this->associationSet[$index]); |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* Gets as associationSet |
327
|
|
|
* |
328
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType[] |
329
|
|
|
*/ |
330
|
|
|
public function getAssociationSet() |
331
|
|
|
{ |
332
|
|
|
return $this->associationSet; |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* Sets a new associationSet |
337
|
|
|
* |
338
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType[] |
339
|
|
|
* $associationSet |
340
|
|
|
* @return self |
341
|
|
|
*/ |
342
|
|
|
public function setAssociationSet(array $associationSet) |
343
|
|
|
{ |
344
|
|
|
$this->associationSet = $associationSet; |
345
|
|
|
return $this; |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
public function isOK(&$msg = null) |
349
|
|
|
{ |
350
|
|
|
if (!$this->isTSimpleIdentifierValid($this->name)) { |
351
|
|
|
$msg = "Name(" . $this->name . ") must be a valid TSimpleIdentifier " . __FILE__ . ":" . __LINE__; |
352
|
|
|
return false; |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
if (null != $this->extends && !$this->isTSimpleIdentifierValid($this->extends)) { |
356
|
|
|
$msg = "Extends must be a valid TSimpleIdentifier"; |
357
|
|
|
return false; |
358
|
|
|
} |
359
|
|
|
|
360
|
|
|
if (null != $this->typeAccess && !($this->isTPublicOrInternalAccessOK($this->typeAccess))) { |
361
|
|
|
$msg = "Type access must be Public or Internal"; |
362
|
|
|
return false; |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
if (!$this->isObjectNullOrOK($this->documentation, $msg)) { |
366
|
|
|
return false; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
if (!$this->isValidArrayOK( |
370
|
|
|
$this->functionImport, |
371
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType', |
372
|
|
|
$msg |
373
|
|
|
)) { |
374
|
|
|
return false; |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
if (!$this->isValidArrayOK( |
378
|
|
|
$this->entitySet, |
379
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType', |
380
|
|
|
$msg |
381
|
|
|
)) { |
382
|
|
|
return false; |
383
|
|
|
} |
384
|
|
|
|
385
|
|
|
if (!$this->isValidArrayOK( |
386
|
|
|
$this->associationSet, |
387
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType', |
388
|
|
|
$msg |
389
|
|
|
)) { |
390
|
|
|
return false; |
391
|
|
|
} |
392
|
|
|
|
393
|
|
|
return true; |
394
|
|
|
} |
395
|
|
|
} |
396
|
|
|
|