1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edmx; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class representing TDesignerType |
9
|
|
|
* |
10
|
|
|
* |
11
|
|
|
* XSD Type: TDesigner |
12
|
|
|
*/ |
13
|
|
|
class TDesignerType extends IsOK |
14
|
|
|
{ |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edmx\TConnectionType $connection |
18
|
|
|
*/ |
19
|
|
|
private $connection = null; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edmx\TOptionsType $options |
23
|
|
|
*/ |
24
|
|
|
private $options = null; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDiagramType[] $diagrams |
28
|
|
|
*/ |
29
|
|
|
private $diagrams = []; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Gets as connection |
33
|
|
|
* |
34
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edmx\TConnectionType |
35
|
|
|
*/ |
36
|
|
|
public function getConnection() |
37
|
|
|
{ |
38
|
|
|
return $this->connection; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Sets a new connection |
43
|
|
|
* |
44
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edmx\TConnectionType $connection |
45
|
|
|
* @return self |
46
|
|
|
*/ |
47
|
|
|
public function setConnection(TConnectionType $connection) |
48
|
|
|
{ |
49
|
|
|
$msg = null; |
50
|
|
|
if (!$connection->isOK($msg)) { |
51
|
|
|
throw new \InvalidArgumentException($msg); |
52
|
|
|
} |
53
|
|
|
$this->connection = $connection; |
54
|
|
|
return $this; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Gets as options |
59
|
|
|
* |
60
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edmx\TOptionsType |
61
|
|
|
*/ |
62
|
|
|
public function getOptions() |
63
|
|
|
{ |
64
|
|
|
return $this->options; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Sets a new options |
69
|
|
|
* |
70
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edmx\TOptionsType $options |
71
|
|
|
* @return self |
72
|
|
|
*/ |
73
|
|
|
public function setOptions(TOptionsType $options) |
74
|
|
|
{ |
75
|
|
|
$msg = null; |
76
|
|
|
if (!$options->isOK($msg)) { |
77
|
|
|
throw new \InvalidArgumentException($msg); |
78
|
|
|
} |
79
|
|
|
$this->options = $options; |
80
|
|
|
return $this; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Adds as diagram |
85
|
|
|
* |
86
|
|
|
* @return self |
87
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDiagramType $diagram |
88
|
|
|
*/ |
89
|
|
|
public function addToDiagrams(TDiagramType $diagram) |
90
|
|
|
{ |
91
|
|
|
$msg = null; |
92
|
|
|
if (!$diagram->isOK($msg)) { |
93
|
|
|
throw new \InvalidArgumentException($msg); |
94
|
|
|
} |
95
|
|
|
$this->diagrams[] = $diagram; |
96
|
|
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* isset diagrams |
101
|
|
|
* |
102
|
|
|
* @param scalar $index |
103
|
|
|
* @return boolean |
104
|
|
|
*/ |
105
|
|
|
public function issetDiagrams($index) |
106
|
|
|
{ |
107
|
|
|
return isset($this->diagrams[$index]); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* unset diagrams |
112
|
|
|
* |
113
|
|
|
* @param scalar $index |
114
|
|
|
* @return void |
115
|
|
|
*/ |
116
|
|
|
public function unsetDiagrams($index) |
117
|
|
|
{ |
118
|
|
|
unset($this->diagrams[$index]); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Gets as diagrams |
123
|
|
|
* |
124
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDiagramType[] |
125
|
|
|
*/ |
126
|
|
|
public function getDiagrams() |
127
|
|
|
{ |
128
|
|
|
return $this->diagrams; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Sets a new diagrams |
133
|
|
|
* |
134
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDiagramType[] $diagrams |
135
|
|
|
* @return self |
136
|
|
|
*/ |
137
|
|
|
public function setDiagrams(array $diagrams) |
138
|
|
|
{ |
139
|
|
|
if (!$this->isValidArrayOK( |
140
|
|
|
$diagrams, |
141
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edmx\TDiagramType' |
142
|
|
|
)) { |
143
|
|
|
$msg = "Diagrams array not a valid array"; |
144
|
|
|
throw new \InvalidArgumentException($msg); |
145
|
|
|
} |
146
|
|
|
$this->diagrams = $diagrams; |
147
|
|
|
return $this; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
public function isOK(&$msg = null) |
151
|
|
|
{ |
152
|
|
|
if (null != $this->connection && !$this->connection->isOK($msg)) { |
153
|
|
|
return false; |
154
|
|
|
} |
155
|
|
|
if (null != $this->options && !$this->options->isOK($msg)) { |
156
|
|
|
return false; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
if (!$this->isValidArray( |
160
|
|
|
$this->diagrams, |
161
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edmx\TDiagramType' |
162
|
|
|
)) { |
163
|
|
|
$msg = "Diagrams array not a valid array"; |
164
|
|
|
return false; |
165
|
|
|
} |
166
|
|
|
if (!$this->isChildArrayOK($this->diagrams, $msg)) { |
167
|
|
|
return false; |
168
|
|
|
} |
169
|
|
|
return true; |
170
|
|
|
} |
171
|
|
|
} |
172
|
|
|
|