1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\EntityContainer; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\EntityStoreSchemaGenerator\TSourceTypeTrait; |
6
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
7
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TCommandTextTrait; |
8
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TSimpleIdentifierTrait; |
9
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TQualifiedNameTrait; |
10
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TUndottedIdentifierTrait; |
11
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class representing EntitySetAnonymousType |
15
|
|
|
*/ |
16
|
|
|
class EntitySetAnonymousType extends IsOK |
17
|
|
|
{ |
18
|
|
|
use TSimpleIdentifierTrait, TUndottedIdentifierTrait, TQualifiedNameTrait, TSourceTypeTrait, TCommandTextTrait; |
19
|
|
|
/** |
20
|
|
|
* @property string $name |
21
|
|
|
*/ |
22
|
|
|
private $name = null; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @property string $entityType |
26
|
|
|
*/ |
27
|
|
|
private $entityType = null; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @property string $schema |
31
|
|
|
*/ |
32
|
|
|
private $schema = null; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @property string $table |
36
|
|
|
*/ |
37
|
|
|
private $table = null; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @property string $type |
41
|
|
|
*/ |
42
|
|
|
private $type = null; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType $documentation |
46
|
|
|
*/ |
47
|
|
|
private $documentation = null; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @property string $definingQuery |
51
|
|
|
*/ |
52
|
|
|
private $definingQuery = null; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Gets as name |
56
|
|
|
* |
57
|
|
|
* @return string |
58
|
|
|
*/ |
59
|
|
|
public function getName() |
60
|
|
|
{ |
61
|
|
|
return $this->name; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Sets a new name |
66
|
|
|
* |
67
|
|
|
* @param string $name |
68
|
|
|
* @return self |
69
|
|
|
*/ |
70
|
|
|
public function setName($name) |
71
|
|
|
{ |
72
|
|
|
$this->name = $name; |
73
|
|
|
return $this; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Gets as entityType |
78
|
|
|
* |
79
|
|
|
* @return string |
80
|
|
|
*/ |
81
|
|
|
public function getEntityType() |
82
|
|
|
{ |
83
|
|
|
return $this->entityType; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Sets a new entityType |
88
|
|
|
* |
89
|
|
|
* @param string $entityType |
90
|
|
|
* @return self |
91
|
|
|
*/ |
92
|
|
|
public function setEntityType($entityType) |
93
|
|
|
{ |
94
|
|
|
$this->entityType = $entityType; |
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Gets as schema |
100
|
|
|
* |
101
|
|
|
* @return string |
102
|
|
|
*/ |
103
|
|
|
public function getSchema() |
104
|
|
|
{ |
105
|
|
|
return $this->schema; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Sets a new schema |
110
|
|
|
* |
111
|
|
|
* @param string $schema |
112
|
|
|
* @return self |
113
|
|
|
*/ |
114
|
|
|
public function setSchema($schema) |
115
|
|
|
{ |
116
|
|
|
$this->schema = $schema; |
117
|
|
|
return $this; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* Gets as table |
122
|
|
|
* |
123
|
|
|
* @return string |
124
|
|
|
*/ |
125
|
|
|
public function getTable() |
126
|
|
|
{ |
127
|
|
|
return $this->table; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Sets a new table |
132
|
|
|
* |
133
|
|
|
* @param string $table |
134
|
|
|
* @return self |
135
|
|
|
*/ |
136
|
|
|
public function setTable($table) |
137
|
|
|
{ |
138
|
|
|
$this->table = $table; |
139
|
|
|
return $this; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Gets as type |
144
|
|
|
* |
145
|
|
|
* @return string |
146
|
|
|
*/ |
147
|
|
|
public function getType() |
148
|
|
|
{ |
149
|
|
|
return $this->type; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* Sets a new type |
154
|
|
|
* |
155
|
|
|
* @param string $type |
156
|
|
|
* @return self |
157
|
|
|
*/ |
158
|
|
|
public function setType($type) |
159
|
|
|
{ |
160
|
|
|
$this->type = $type; |
161
|
|
|
return $this; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Gets as documentation |
166
|
|
|
* |
167
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType |
168
|
|
|
*/ |
169
|
|
|
public function getDocumentation() |
170
|
|
|
{ |
171
|
|
|
return $this->documentation; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* Sets a new documentation |
176
|
|
|
* |
177
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType $documentation |
178
|
|
|
* @return self |
179
|
|
|
*/ |
180
|
|
|
public function setDocumentation(TDocumentationType $documentation) |
181
|
|
|
{ |
182
|
|
|
$this->documentation = $documentation; |
183
|
|
|
return $this; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Gets as definingQuery |
188
|
|
|
* |
189
|
|
|
* @return string |
190
|
|
|
*/ |
191
|
|
|
public function getDefiningQuery() |
192
|
|
|
{ |
193
|
|
|
return $this->definingQuery; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* Sets a new definingQuery |
198
|
|
|
* |
199
|
|
|
* @param string $definingQuery |
200
|
|
|
* @return self |
201
|
|
|
*/ |
202
|
|
|
public function setDefiningQuery($definingQuery) |
203
|
|
|
{ |
204
|
|
|
$this->definingQuery = $definingQuery; |
205
|
|
|
return $this; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
public function isOK(&$msg = null) |
209
|
|
|
{ |
210
|
|
|
if (!$this->isTUndottedIdentifierValid($this->name)) { |
211
|
|
|
$msg = "Name must be a valid TUndottedIdentifier"; |
212
|
|
|
return false; |
213
|
|
|
} |
214
|
|
|
if (!$this->isTQualifiedNameValid($this->entityType)) { |
215
|
|
|
$msg = "Entity type must be a valid TQualifiedName"; |
216
|
|
|
return false; |
217
|
|
|
} |
218
|
|
View Code Duplication |
if (null != $this->schema && !$this->isTSimpleIdentifierValid($this->schema)) { |
|
|
|
|
219
|
|
|
$msg = "Schema must be a valid TSimpleIdentifier"; |
220
|
|
|
return false; |
221
|
|
|
} |
222
|
|
|
if (null != $this->table && !$this->isTSimpleIdentifierValid($this->table)) { |
223
|
|
|
$msg = "Table must be a valid TSimpleIdentifier"; |
224
|
|
|
return false; |
225
|
|
|
} |
226
|
|
|
if (null != $this->type && !$this->isTSourceTypeValid($this->type)) { |
227
|
|
|
$msg = "Type must be a valid TSourceType"; |
228
|
|
|
return false; |
229
|
|
|
} |
230
|
|
|
if (null != $this->definingQuery && !$this->isTCommandTextValid($this->definingQuery)) { |
231
|
|
|
$msg = "Defining query must be a valid TCommandText"; |
232
|
|
|
return false; |
233
|
|
|
} |
234
|
|
|
if (!$this->isObjectNullOrType( |
235
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType', |
236
|
|
|
$this->documentation, |
237
|
|
|
$msg |
238
|
|
|
)) { |
239
|
|
|
return false; |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
return true; |
243
|
|
|
} |
244
|
|
|
} |
245
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.