1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edm; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\Annotations\TGenerationPatternTrait; |
6
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
7
|
|
|
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait; |
8
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\Groups\TCommonPropertyAttributesTrait; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class representing TEntityPropertyType |
12
|
|
|
* |
13
|
|
|
* |
14
|
|
|
* XSD Type: TEntityProperty |
15
|
|
|
*/ |
16
|
|
|
class TEntityPropertyType extends IsOK |
17
|
|
|
{ |
18
|
|
|
use IsOKToolboxTrait, TCommonPropertyAttributesTrait, TGenerationPatternTrait; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @property string $storeGeneratedPattern |
22
|
|
|
*/ |
23
|
|
|
private $storeGeneratedPattern = null; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType[] $documentation |
27
|
|
|
*/ |
28
|
|
|
private $documentation = []; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation |
32
|
|
|
*/ |
33
|
|
|
private $valueAnnotation = []; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation |
37
|
|
|
*/ |
38
|
|
|
private $typeAnnotation = []; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Gets as storeGeneratedPattern |
42
|
|
|
* |
43
|
|
|
* @return string |
44
|
|
|
*/ |
45
|
|
|
public function getStoreGeneratedPattern() |
46
|
|
|
{ |
47
|
|
|
return $this->storeGeneratedPattern; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Sets a new storeGeneratedPattern |
52
|
|
|
* |
53
|
|
|
* @param string $storeGeneratedPattern |
54
|
|
|
* @return self |
55
|
|
|
*/ |
56
|
|
|
public function setStoreGeneratedPattern($storeGeneratedPattern) |
57
|
|
|
{ |
58
|
|
|
$this->storeGeneratedPattern = $storeGeneratedPattern; |
59
|
|
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Adds as documentation |
64
|
|
|
* |
65
|
|
|
* @return self |
66
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation |
67
|
|
|
*/ |
68
|
|
|
public function addToDocumentation(TDocumentationType $documentation) |
69
|
|
|
{ |
70
|
|
|
$this->documentation[] = $documentation; |
71
|
|
|
return $this; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* isset documentation |
76
|
|
|
* |
77
|
|
|
* @param scalar $index |
78
|
|
|
* @return boolean |
79
|
|
|
*/ |
80
|
|
|
public function issetDocumentation($index) |
81
|
|
|
{ |
82
|
|
|
return isset($this->documentation[$index]); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* unset documentation |
87
|
|
|
* |
88
|
|
|
* @param scalar $index |
89
|
|
|
* @return void |
90
|
|
|
*/ |
91
|
|
|
public function unsetDocumentation($index) |
92
|
|
|
{ |
93
|
|
|
unset($this->documentation[$index]); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Gets as documentation |
98
|
|
|
* |
99
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType[] |
100
|
|
|
*/ |
101
|
|
|
public function getDocumentation() |
102
|
|
|
{ |
103
|
|
|
return $this->documentation; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Sets a new documentation |
108
|
|
|
* |
109
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType[] $documentation |
110
|
|
|
* @return self |
111
|
|
|
*/ |
112
|
|
|
public function setDocumentation(array $documentation) |
113
|
|
|
{ |
114
|
|
|
$this->documentation = $documentation; |
115
|
|
|
return $this; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Adds as valueAnnotation |
120
|
|
|
* |
121
|
|
|
* @return self |
122
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType $valueAnnotation |
123
|
|
|
*/ |
124
|
|
|
public function addToValueAnnotation(TValueAnnotationType $valueAnnotation) |
125
|
|
|
{ |
126
|
|
|
$this->valueAnnotation[] = $valueAnnotation; |
127
|
|
|
return $this; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* isset valueAnnotation |
132
|
|
|
* |
133
|
|
|
* @param scalar $index |
134
|
|
|
* @return boolean |
135
|
|
|
*/ |
136
|
|
|
public function issetValueAnnotation($index) |
137
|
|
|
{ |
138
|
|
|
return isset($this->valueAnnotation[$index]); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* unset valueAnnotation |
143
|
|
|
* |
144
|
|
|
* @param scalar $index |
145
|
|
|
* @return void |
146
|
|
|
*/ |
147
|
|
|
public function unsetValueAnnotation($index) |
148
|
|
|
{ |
149
|
|
|
unset($this->valueAnnotation[$index]); |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* Gets as valueAnnotation |
154
|
|
|
* |
155
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] |
156
|
|
|
*/ |
157
|
|
|
public function getValueAnnotation() |
158
|
|
|
{ |
159
|
|
|
return $this->valueAnnotation; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* Sets a new valueAnnotation |
164
|
|
|
* |
165
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation |
166
|
|
|
* @return self |
167
|
|
|
*/ |
168
|
|
|
public function setValueAnnotation(array $valueAnnotation) |
169
|
|
|
{ |
170
|
|
|
$this->valueAnnotation = $valueAnnotation; |
171
|
|
|
return $this; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* Adds as typeAnnotation |
176
|
|
|
* |
177
|
|
|
* @return self |
178
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType $typeAnnotation |
179
|
|
|
*/ |
180
|
|
|
public function addToTypeAnnotation(TTypeAnnotationType $typeAnnotation) |
181
|
|
|
{ |
182
|
|
|
$this->typeAnnotation[] = $typeAnnotation; |
183
|
|
|
return $this; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* isset typeAnnotation |
188
|
|
|
* |
189
|
|
|
* @param scalar $index |
190
|
|
|
* @return boolean |
191
|
|
|
*/ |
192
|
|
|
public function issetTypeAnnotation($index) |
193
|
|
|
{ |
194
|
|
|
return isset($this->typeAnnotation[$index]); |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* unset typeAnnotation |
199
|
|
|
* |
200
|
|
|
* @param scalar $index |
201
|
|
|
* @return void |
202
|
|
|
*/ |
203
|
|
|
public function unsetTypeAnnotation($index) |
204
|
|
|
{ |
205
|
|
|
unset($this->typeAnnotation[$index]); |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* Gets as typeAnnotation |
210
|
|
|
* |
211
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] |
212
|
|
|
*/ |
213
|
|
|
public function getTypeAnnotation() |
214
|
|
|
{ |
215
|
|
|
return $this->typeAnnotation; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* Sets a new typeAnnotation |
220
|
|
|
* |
221
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation |
222
|
|
|
* @return self |
223
|
|
|
*/ |
224
|
|
|
public function setTypeAnnotation(array $typeAnnotation) |
225
|
|
|
{ |
226
|
|
|
$this->typeAnnotation = $typeAnnotation; |
227
|
|
|
return $this; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
public function isOK(&$msg = null) |
231
|
|
|
{ |
232
|
|
|
if (!$this->isTGenerationPatternValid($this->storeGeneratedPattern)) { |
233
|
|
|
$msg = "Store generation pattern must be a valid TGenerationPattern"; |
234
|
|
|
return false; |
235
|
|
|
} |
236
|
|
|
if (!$this->isValidArrayOK( |
237
|
|
|
$this->documentation, |
238
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType', |
239
|
|
|
$msg, |
240
|
|
|
0, |
241
|
|
|
1 |
242
|
|
|
)) { |
243
|
|
|
return false; |
244
|
|
|
} |
245
|
|
|
if (!$this->isValidArrayOK( |
246
|
|
|
$this->valueAnnotation, |
247
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType', |
248
|
|
|
$msg |
249
|
|
|
)) { |
250
|
|
|
return false; |
251
|
|
|
} |
252
|
|
|
if (!$this->isValidArrayOK( |
253
|
|
|
$this->typeAnnotation, |
254
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType', |
255
|
|
|
$msg |
256
|
|
|
)) { |
257
|
|
|
return false; |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
if (!$this->isTCommonPropertyAttributesValid($msg)) { |
261
|
|
|
return false; |
262
|
|
|
} |
263
|
|
|
return true; |
264
|
|
|
} |
265
|
|
|
} |
266
|
|
|
|