1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\PODataLaravel\Models; |
4
|
|
|
|
5
|
|
|
class EntityField |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* @var string |
9
|
|
|
*/ |
10
|
|
|
private $name; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @var EntityFieldType; |
14
|
|
|
*/ |
15
|
|
|
private $fieldType; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var bool |
19
|
|
|
*/ |
20
|
|
|
private $isNullable; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var mixed |
24
|
|
|
*/ |
25
|
|
|
private $defaultValue; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var bool |
29
|
|
|
*/ |
30
|
|
|
private $readOnly; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var bool |
34
|
|
|
*/ |
35
|
|
|
private $createOnly; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var bool |
39
|
|
|
*/ |
40
|
|
|
private $isKeyField; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return string |
44
|
|
|
*/ |
45
|
|
|
public function getName() |
46
|
|
|
{ |
47
|
|
|
return $this->name; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param string $name |
52
|
|
|
*/ |
53
|
|
|
public function setName($name) |
54
|
|
|
{ |
55
|
|
|
$this->name = $name; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return EntityFieldType |
60
|
|
|
*/ |
61
|
|
|
public function getFieldType() |
62
|
|
|
{ |
63
|
|
|
return $this->fieldType; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param EntityFieldType $fieldType |
68
|
|
|
*/ |
69
|
|
|
public function setFieldType(EntityFieldType $fieldType) |
70
|
|
|
{ |
71
|
|
|
$this->fieldType = $fieldType; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return boolean |
76
|
|
|
*/ |
77
|
|
|
public function getIsNullable() |
|
|
|
|
78
|
|
|
{ |
79
|
|
|
return $this->isNullable; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param boolean $isNullable |
84
|
|
|
*/ |
85
|
|
|
public function setIsNullable($isNullable) |
86
|
|
|
{ |
87
|
|
|
$this->isNullable = boolval($isNullable); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return mixed |
92
|
|
|
*/ |
93
|
|
|
public function getDefaultValue() |
94
|
|
|
{ |
95
|
|
|
return $this->defaultValue; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param mixed $defaultValue |
100
|
|
|
*/ |
101
|
|
|
public function setDefaultValue($defaultValue) |
102
|
|
|
{ |
103
|
|
|
$this->defaultValue = $defaultValue; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return boolean |
108
|
|
|
*/ |
109
|
|
|
public function getReadOnly() |
|
|
|
|
110
|
|
|
{ |
111
|
|
|
return $this->readOnly; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @param boolean $readOnly |
116
|
|
|
*/ |
117
|
|
|
public function setReadOnly($readOnly) |
118
|
|
|
{ |
119
|
|
|
$this->readOnly = boolval($readOnly); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @return boolean |
124
|
|
|
*/ |
125
|
|
|
public function getCreateOnly() |
|
|
|
|
126
|
|
|
{ |
127
|
|
|
return $this->createOnly; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @param boolean $createOnly |
132
|
|
|
*/ |
133
|
|
|
public function setCreateOnly($createOnly) |
134
|
|
|
{ |
135
|
|
|
$this->createOnly = boolval($createOnly); |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @return boolean |
140
|
|
|
*/ |
141
|
|
|
public function getIsKeyField() |
|
|
|
|
142
|
|
|
{ |
143
|
|
|
return $this->isKeyField; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @param boolean $keyField |
148
|
|
|
*/ |
149
|
|
|
public function setIsKeyField($keyField) |
150
|
|
|
{ |
151
|
|
|
$this->isKeyField = boolval($keyField); |
152
|
|
|
} |
153
|
|
|
} |
154
|
|
|
|
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.