-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathField.php
More file actions
201 lines (169 loc) · 4.12 KB
/
Field.php
File metadata and controls
201 lines (169 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?php
namespace Vayes\Tier;
class Field
{
/** @var string */
private $columnName;
/** @var string */
private $tableName;
/** @var string */
private $compoundName;
/** @var string */
private $columnSlug;
/** @var string */
private $tableSlug;
/** @var string */
private $compoundSlug;
/** @var string */
private $varType;
/** @var string */
private $modelName;
/** @var bool */
private $multilingual = false;
/** @var string */
private $identifier;
public function getColumnName(): ?string
{
return $this->columnName;
}
/**
* @param string $columnName
* @return $this
*/
public function setColumnName(string $columnName): self
{
$this->columnName = $columnName;
$this->identifier = (string) $this->tableName . '|' . (string) $this->columnSlug;
return $this;
}
public function getTableName(): ?string
{
return $this->tableName;
}
/**
* @param string $tableName
* @return $this
*/
public function setTableName(string $tableName): self
{
$this->tableName = $tableName;
$this->identifier = (string) $this->tableName . '|' . (string) $this->columnSlug;
return $this;
}
public function getCompoundName(): ?string
{
return $this->compoundName;
}
/**
* @param string $compoundName
* @return $this
*/
public function setCompoundName(string $compoundName): self
{
$this->compoundName = $compoundName;
return $this;
}
public function getColumnSlug(): ?string
{
return $this->columnSlug;
}
/**
* @param string $columnSlug
* @return $this
*/
public function setColumnSlug(string $columnSlug): self
{
$this->columnSlug = $columnSlug;
$this->compoundSlug = (string) $this->tableSlug . '|' . (string) $this->columnSlug;
return $this;
}
public function getTableSlug(): string
{
return $this->tableSlug;
}
/**
* @param string $tableSlug
* @return $this
*/
public function setTableSlug(string $tableSlug): self
{
$this->tableSlug = $tableSlug;
$this->compoundSlug = (string) $this->tableSlug . '|' . (string) $this->columnSlug;
return $this;
}
public function getCompoundSlug(): string
{
return $this->compoundSlug;
}
/**
* @param string $compoundSlug
* @return $this
*/
public function setCompoundSlug(string $compoundSlug): self
{
$this->compoundSlug = $compoundSlug;
return $this;
}
public function getVarType(): ?string
{
return $this->varType;
}
/**
* @param string $varType
* @return $this
*/
public function setVarType(string $varType): self
{
$this->varType = $varType;
return $this;
}
public function getModelName(): ?string
{
return $this->modelName;
}
/**
* @param string $modelName
* @return $this
*/
public function setModelName(string $modelName): self
{
$this->modelName = $modelName;
return $this;
}
public function isMultilingual(): bool
{
return $this->multilingual;
}
/**
* @param bool $multilingual
* @return $this
*/
public function setMultilingual(bool $multilingual): self
{
$this->multilingual = $multilingual;
return $this;
}
public function getIdentifier(): ?string
{
return $this->identifier;
}
/**
* @param string $identifier
* @return $this
*/
public function setIdentifier(string $identifier): self
{
$this->identifier = $identifier;
return $this;
}
/**
* @param string $tableAlias
* @return string
*/
public function getAliasedColumnName(string $tableAlias, bool $isMultilingual = false): string
{
return false === $isMultilingual
? $tableAlias . '.' . $this->getColumnName()
: $tableAlias .'_t' . '.' . $this->getColumnName();
}
}