1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edm; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
6
|
|
|
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait; |
7
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class representing TAssociationType |
11
|
|
|
* |
12
|
|
|
* |
13
|
|
|
* XSD Type: TAssociation |
14
|
|
|
*/ |
15
|
|
|
class TAssociationType extends IsOK |
16
|
|
|
{ |
17
|
|
|
use IsOKToolboxTrait, TSimpleIdentifierTrait; |
18
|
|
|
/** |
19
|
|
|
* @property string $name |
20
|
|
|
*/ |
21
|
|
|
private $name = null; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation |
25
|
|
|
*/ |
26
|
|
|
private $documentation = null; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TAssociationEndType[] $end |
30
|
|
|
*/ |
31
|
|
|
private $end = []; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TConstraintType $referentialConstraint |
35
|
|
|
*/ |
36
|
|
|
private $referentialConstraint = null; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Gets as name |
40
|
|
|
* |
41
|
|
|
* @return string |
42
|
|
|
*/ |
43
|
|
|
public function getName() |
44
|
|
|
{ |
45
|
|
|
return $this->name; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Sets a new name |
50
|
|
|
* |
51
|
|
|
* @param string $name |
52
|
|
|
* @return self |
53
|
|
|
*/ |
54
|
|
|
public function setName($name) |
55
|
|
|
{ |
56
|
|
|
$this->name = $name; |
57
|
|
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Gets as documentation |
62
|
|
|
* |
63
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType |
64
|
|
|
*/ |
65
|
|
|
public function getDocumentation() |
66
|
|
|
{ |
67
|
|
|
return $this->documentation; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Sets a new documentation |
72
|
|
|
* |
73
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation |
74
|
|
|
* @return self |
75
|
|
|
*/ |
76
|
|
|
public function setDocumentation(TDocumentationType $documentation) |
77
|
|
|
{ |
78
|
|
|
$this->documentation = $documentation; |
79
|
|
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Adds as end |
84
|
|
|
* |
85
|
|
|
* @return self |
86
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TAssociationEndType $end |
87
|
|
|
*/ |
88
|
|
|
public function addToEnd(TAssociationEndType $end) |
89
|
|
|
{ |
90
|
|
|
$this->end[] = $end; |
91
|
|
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* isset end |
96
|
|
|
* |
97
|
|
|
* @param scalar $index |
98
|
|
|
* @return boolean |
99
|
|
|
*/ |
100
|
|
|
public function issetEnd($index) |
101
|
|
|
{ |
102
|
|
|
return isset($this->end[$index]); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* unset end |
107
|
|
|
* |
108
|
|
|
* @param scalar $index |
109
|
|
|
* @return void |
110
|
|
|
*/ |
111
|
|
|
public function unsetEnd($index) |
112
|
|
|
{ |
113
|
|
|
unset($this->end[$index]); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Gets as end |
118
|
|
|
* |
119
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TAssociationEndType[] |
120
|
|
|
*/ |
121
|
|
|
public function getEnd() |
122
|
|
|
{ |
123
|
|
|
return $this->end; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Sets a new end |
128
|
|
|
* |
129
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TAssociationEndType[] $end |
130
|
|
|
* @return self |
131
|
|
|
*/ |
132
|
|
|
public function setEnd(array $end) |
133
|
|
|
{ |
134
|
|
|
$this->end = $end; |
135
|
|
|
return $this; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* Gets as referentialConstraint |
140
|
|
|
* |
141
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TConstraintType |
142
|
|
|
*/ |
143
|
|
|
public function getReferentialConstraint() |
144
|
|
|
{ |
145
|
|
|
return $this->referentialConstraint; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Sets a new referentialConstraint |
150
|
|
|
* |
151
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TConstraintType $referentialConstraint |
152
|
|
|
* @return self |
153
|
|
|
*/ |
154
|
|
|
public function setReferentialConstraint(TConstraintType $referentialConstraint) |
155
|
|
|
{ |
156
|
|
|
$this->referentialConstraint = $referentialConstraint; |
157
|
|
|
return $this; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
public function isOK(&$msg = null) |
161
|
|
|
{ |
162
|
|
|
if (!$this->isTSimpleIdentifierValid($this->name)) { |
163
|
|
|
$msg = "Name must be a valid TSimpleIdentifier"; |
164
|
|
|
return false; |
165
|
|
|
} |
166
|
|
|
if (null != $this->isObjectNullOrOK($this->documentation, $msg)) { |
167
|
|
|
return false; |
168
|
|
|
} |
169
|
|
|
if (null != $this->isObjectNullOrOK($this->referentialConstraint, $msg)) { |
170
|
|
|
return false; |
171
|
|
|
} |
172
|
|
|
if (!$this->isValidArrayOK( |
173
|
|
|
$this->end, |
174
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\TAssociationEndType', |
175
|
|
|
$msg, |
176
|
|
|
2, |
177
|
|
|
2 |
178
|
|
|
)) { |
179
|
|
|
return false; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
return true; |
183
|
|
|
} |
184
|
|
|
} |
185
|
|
|
|