Completed
Push — feature/serializer-groups ( 7eaea2 )
by Narcotic
63:05
created

Field::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Part of JSON definition
4
 */
5
namespace Graviton\GeneratorBundle\Definition\Schema;
6
7
/**
8
 * JSON definition "target.fields"
9
 *
10
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
11
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
12
 * @link     http://swisscom.ch
13
 */
14
class Field
15
{
16
    /**
17
     * @var string
18
     */
19
    private $name;
20
    /**
21
     * @var array
22
     */
23
    private $groups;
24
    /**
25
     * @var string
26
     */
27
    private $type;
28
    /**
29
     * @var int
30
     */
31
    private $length;
32
    /**
33
     * @var string
34
     */
35
    private $title;
36
    /**
37
     * @var string
38
     */
39
    private $description;
40
    /**
41
     * @var string
42
     */
43
    private $exposeAs;
44
    /**
45
     * @var bool
46
     */
47
    private $readOnly = false;
48
    /**
49
     * @var bool
50
     */
51
    private $recordOriginException = false;
52
    /**
53
     * @var bool
54
     */
55
    private $required = false;
56
    /**
57
     * @var integer
58
     */
59
    private $searchable = 0;
60
    /**
61
     * @var bool
62
     */
63
    private $translatable = false;
64
    /**
65
     * @var Constraint[]
66
     */
67
    private $constraints = [];
68
69
    /**
70
     * @var array
71
     */
72
    private $collection = [];
73
74
    /**
75
     * @var XDynamicKey
76
     */
77
    private $xDynamicKey;
78
79
    /**
80
     * @return string
81
     */
82
    public function getName()
83
    {
84
        return $this->name;
85
    }
86
87
    /**
88
     * @param string $name Field name
89
     * @return $this
90
     */
91
    public function setName($name)
92
    {
93
        $this->name = $name;
94
        return $this;
95
    }
96
97
    /**
98
     * get Groups
99
     *
100
     * @return array Groups
101
     */
102
    public function getGroups()
103
    {
104
        return $this->groups;
105
    }
106
107
    /**
108
     * set Groups
109
     *
110
     * @param array $groups groups
111
     *
112
     * @return void
113
     */
114
    public function setGroups($groups)
115
    {
116
        $this->groups = $groups;
117
    }
118
119
    /**
120
     * @return string
121
     */
122
    public function getType()
123
    {
124
        return $this->type;
125
    }
126
127
    /**
128
     * @param string $type Field type
129
     * @return $this
130
     */
131
    public function setType($type)
132
    {
133
        $this->type = $type;
134
        return $this;
135
    }
136
137
    /**
138
     * @return int
139
     */
140
    public function getLength()
141
    {
142
        return $this->length;
143
    }
144
145
    /**
146
     * @param int $length Field length
147
     * @return $this
148
     */
149
    public function setLength($length)
150
    {
151
        $this->length = $length;
152
        return $this;
153
    }
154
155
    /**
156
     * @return string
157
     */
158
    public function getTitle()
159
    {
160
        return $this->title;
161
    }
162
163
    /**
164
     * @param string $title Field title
165
     * @return $this
166
     */
167
    public function setTitle($title)
168
    {
169
        $this->title = $title;
170
        return $this;
171
    }
172
173
    /**
174
     * @return string
175
     */
176
    public function getDescription()
177
    {
178
        return $this->description;
179
    }
180
181
    /**
182
     * @param string $description Field description
183
     * @return $this
184
     */
185
    public function setDescription($description)
186
    {
187
        $this->description = $description;
188
        return $this;
189
    }
190
191
    /**
192
     * @return string
193
     */
194
    public function getExposeAs()
195
    {
196
        return $this->exposeAs;
197
    }
198
199
    /**
200
     * @param string $exposeAs Expose field as ...
201
     * @return $this
202
     */
203
    public function setExposeAs($exposeAs)
204
    {
205
        $this->exposeAs = $exposeAs;
206
        return $this;
207
    }
208
209
    /**
210
     * @return bool
211
     */
212
    public function getReadOnly()
213
    {
214
        return $this->readOnly;
215
    }
216
217
    /**
218
     * @param bool $readOnly Is field readonly
219
     * @return $this
220
     */
221
    public function setReadOnly($readOnly)
222
    {
223
        $this->readOnly = $readOnly;
224
        return $this;
225
    }
226
227
    /**
228
     * get RecordOriginException
229
     *
230
     * @return boolean RecordOriginException
231
     */
232
    public function isRecordOriginException()
233
    {
234
        return $this->recordOriginException;
235
    }
236
237
    /**
238
     * set RecordOriginException
239
     *
240
     * @param boolean $recordOriginException recordOriginException
241
     *
242
     * @return void
243
     */
244
    public function setRecordOriginException($recordOriginException)
245
    {
246
        $this->recordOriginException = $recordOriginException;
247
    }
248
249
    /**
250
     * @return bool
251
     */
252
    public function getRequired()
253
    {
254
        return $this->required;
255
    }
256
257
    /**
258
     * @param bool $required Is field required
259
     * @return $this
260
     */
261
    public function setRequired($required)
262
    {
263
        $this->required = $required;
264
        return $this;
265
    }
266
267
    /**
268
     * @return bool
269
     */
270
    public function getTranslatable()
271
    {
272
        return $this->translatable;
273
    }
274
275
    /**
276
     * @param bool $translatable Is field translatable
277
     * @return $this
278
     */
279
    public function setTranslatable($translatable)
280
    {
281
        $this->translatable = $translatable;
282
        return $this;
283
    }
284
285
    /**
286
     * @return Constraint[]
287
     */
288
    public function getConstraints()
289
    {
290
        return $this->constraints;
291
    }
292
293
    /**
294
     * @param Constraint[] $constraints Field constraints
295
     * @return $this
296
     */
297
    public function setConstraints(array $constraints)
298
    {
299
        $this->constraints = $constraints;
300
        return $this;
301
    }
302
303
    /**
304
     * @return array
305
     */
306
    public function getCollection()
307
    {
308
        return $this->collection;
309
    }
310
311
    /**
312
     * @param array $collection Field
313
     * @return $this
314
     */
315
    public function setCollection(array $collection)
316
    {
317
        $this->collection = $collection;
318
        return $this;
319
    }
320
321
    /**
322
     * @return XDynamicKey
323
     */
324
    public function getXDynamicKey()
325
    {
326
        return $this->xDynamicKey;
327
    }
328
329
    /**
330
     * @param XDynamicKey $xDynamicKey x-dynamic-key field value
331
     * @return $this
332
     */
333
    public function setXDynamicKey(XDynamicKey $xDynamicKey)
334
    {
335
        $this->xDynamicKey = $xDynamicKey;
336
        return $this;
337
    }
338
339
    /**
340
     * @return integer
341
     */
342
    public function getSearchable()
343
    {
344
        return (int) $this->searchable;
345
    }
346
347
    /**
348
     * @param integer $searchable searchable flag
349
     *
350
     * @return void
351
     */
352
    public function setSearchable($searchable)
353
    {
354
        $this->searchable = (int) $searchable;
355
    }
356
}
357