|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @category Brownie/BpmOnline |
|
4
|
|
|
* @author Brownie <[email protected]> |
|
5
|
|
|
* @license https://opensource.org/licenses/MIT |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace Brownie\BpmOnline\DataService\Column\Expression; |
|
9
|
|
|
|
|
10
|
|
|
use Brownie\BpmOnline\DataService\Type\DataValueType; |
|
11
|
|
|
use Brownie\BpmOnline\Exception\ValidateException; |
|
12
|
|
|
use Brownie\BpmOnline\DataService\Column\Expression; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* The Parameter class is defined in the Terrasoft.Nui.ServiceModel.DataContract namespace. |
|
16
|
|
|
* |
|
17
|
|
|
* @method bool getArrayValue() Returns an array of column values. |
|
18
|
|
|
* @method bool setArrayValue(array $values) Sets an array of values column. |
|
19
|
|
|
* @method bool getShouldSkipConvertion() Returns the flag to skip the cast process. |
|
20
|
|
|
* @method Parameter setShouldSkipConvertion($isSkip) Sets the flag to skip the cast process. |
|
21
|
|
|
* for the Value property. |
|
22
|
|
|
*/ |
|
23
|
|
|
class Parameter extends Expression |
|
24
|
|
|
{ |
|
25
|
|
|
|
|
26
|
|
|
const GUID = 0; |
|
27
|
|
|
|
|
28
|
|
|
const TEXT = 1; |
|
29
|
|
|
|
|
30
|
|
|
const INTEGER = 4; |
|
31
|
|
|
|
|
32
|
|
|
const FLOAT = 5; |
|
33
|
|
|
|
|
34
|
|
|
const MONEY = 6; |
|
35
|
|
|
|
|
36
|
|
|
const DATE_TIME = 7; |
|
37
|
|
|
|
|
38
|
|
|
const DATE = 8; |
|
39
|
|
|
|
|
40
|
|
|
const TIME = 9; |
|
41
|
|
|
|
|
42
|
|
|
const LOOKUP = 10; |
|
43
|
|
|
|
|
44
|
|
|
const ENUM = 11; |
|
45
|
|
|
|
|
46
|
|
|
const BOOLEAN = 12; |
|
47
|
|
|
|
|
48
|
|
|
const BLOB = 13; |
|
49
|
|
|
|
|
50
|
|
|
const IMAGE = 14; |
|
51
|
|
|
|
|
52
|
|
|
const IMAGE_LOOKUP = 16; |
|
53
|
|
|
|
|
54
|
|
|
const COLOR = 18; |
|
55
|
|
|
|
|
56
|
|
|
const MAPPING = 26; |
|
57
|
|
|
|
|
58
|
|
|
protected $keyName = 'Parameter'; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Sets the input values. |
|
62
|
|
|
* |
|
63
|
|
|
* @param mixed $value Value. |
|
64
|
|
|
* @param int $valueType Data value type. |
|
65
|
|
|
*/ |
|
66
|
4 |
|
public function __construct($value, $valueType = self::TEXT) |
|
67
|
|
|
{ |
|
68
|
4 |
|
parent::__construct([ |
|
69
|
4 |
|
'dataValueType' => $valueType, |
|
70
|
4 |
|
'value' => $value, |
|
71
|
|
|
]); |
|
72
|
4 |
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* List of supported fields. |
|
76
|
|
|
* |
|
77
|
|
|
* @var array |
|
78
|
|
|
*/ |
|
79
|
|
|
protected $fields = [ |
|
80
|
|
|
'dataValueType' => self::TEXT, |
|
81
|
|
|
'value' => '', |
|
82
|
|
|
'arrayValue' => [], |
|
83
|
|
|
'shouldSkipConvertion' => false, |
|
84
|
|
|
]; |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* Returns data as an associative array. |
|
88
|
|
|
* |
|
89
|
|
|
* @return array |
|
90
|
|
|
* |
|
91
|
|
|
* @throws ValidateException |
|
92
|
|
|
*/ |
|
93
|
3 |
|
public function getValue() |
|
94
|
|
|
{ |
|
95
|
|
|
$data = [ |
|
96
|
3 |
|
'DataValueType' => $this->getDataValueType(), |
|
|
|
|
|
|
97
|
3 |
|
'Value' => parent::getValue(), |
|
98
|
|
|
]; |
|
99
|
3 |
|
if (!empty($this->getArrayValue()) && is_array($this->getArrayValue())) { |
|
100
|
1 |
|
$data['ArrayValue'] = $this->getArrayValue(); |
|
101
|
|
|
} |
|
102
|
3 |
|
if (!empty($this->getShouldSkipConvertion())) { |
|
103
|
1 |
|
$data['ShouldSkipConvertion'] = true; |
|
104
|
|
|
} |
|
105
|
3 |
|
return $data; |
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
|
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: