|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType; |
|
4
|
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
|
6
|
|
|
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait; |
|
7
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\Groups\GEmptyElementExtensibilityTrait; |
|
8
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait; |
|
9
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class representing EndAnonymousType |
|
13
|
|
|
*/ |
|
14
|
|
|
class EndAnonymousType extends IsOK |
|
15
|
|
|
{ |
|
16
|
|
|
//1. The number of Ends has to match with ones defined in AssociationType |
|
17
|
|
|
//2. Value for attribute Name should match the defined ones and EntitySet should be of the |
|
18
|
|
|
// defined Entity Type in AssociationType |
|
19
|
|
|
|
|
20
|
|
|
use IsOKToolboxTrait, TSimpleIdentifierTrait, GEmptyElementExtensibilityTrait; |
|
21
|
|
|
/** |
|
22
|
|
|
* @property string $role |
|
23
|
|
|
*/ |
|
24
|
|
|
private $role = null; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @property string $entitySet |
|
28
|
|
|
*/ |
|
29
|
|
|
private $entitySet = null; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Gets as role |
|
33
|
|
|
* |
|
34
|
|
|
* @return string |
|
35
|
|
|
*/ |
|
36
|
|
|
public function getRole() |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->role; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Sets a new role |
|
43
|
|
|
* |
|
44
|
|
|
* @param string $role |
|
45
|
|
|
* @return self |
|
46
|
|
|
*/ |
|
47
|
|
|
public function setRole($role) |
|
48
|
|
|
{ |
|
49
|
|
|
$this->role = $role; |
|
50
|
|
|
return $this; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Gets as entitySet |
|
55
|
|
|
* |
|
56
|
|
|
* @return string |
|
57
|
|
|
*/ |
|
58
|
|
|
public function getEntitySet() |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->entitySet; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Sets a new entitySet |
|
65
|
|
|
* |
|
66
|
|
|
* @param string $entitySet |
|
67
|
|
|
* @return self |
|
68
|
|
|
*/ |
|
69
|
|
|
public function setEntitySet($entitySet) |
|
70
|
|
|
{ |
|
71
|
|
|
$this->entitySet = $entitySet; |
|
72
|
|
|
return $this; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function isOK(&$msg = null) |
|
76
|
|
|
{ |
|
77
|
|
|
if (!$this->isTSimpleIdentifierValid($this->entitySet)) { |
|
78
|
|
|
$msg = "Entity set must be a valid TSimpleIdentifier"; |
|
79
|
|
|
return false; |
|
80
|
|
|
} |
|
81
|
|
|
if (null != $this->role && !$this->isTSimpleIdentifierValid($this->role)) { |
|
82
|
|
|
$msg = "Role must be a valid TSimpleIdentifier"; |
|
83
|
|
|
return false; |
|
84
|
|
|
} |
|
85
|
|
|
if (!$this->isExtensibilityElementOK($msg)) { |
|
86
|
|
|
return false; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
return true; |
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
|