Passed
Push — master ( d83551...3d9efb )
by Piotr
05:38
created

NumberingCounterData::__clone()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace LSB\NumberingBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use LSB\NumberingBundle\Model\TimeContext;
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
10
/**
11
 * Class NumberingCounterData
12
 * @package LSB\NumberingBundle\Entity
13
 *
14
 * @ORM\Entity(repositoryClass="LSB\NumberingBundle\Repository\NumberingCounterDataRepository")
15
 * @ORM\Table(name="numbering_counter_data")
16
 */
17
class NumberingCounterData
18
{
19
    const DEFAULT_START = 1;
20
    const DEFAULT_STEP = 1;
21
22
    /**
23
     * @var integer
24
     * @ORM\Id()
25
     * @ORM\GeneratedValue(strategy="IDENTITY")
26
     * @ORM\Column(type="integer")
27
     */
28
    protected $id;
29
30
    /**
31
     * Pattern name from configuration
32
     *
33
     * @var string
34
     * @ORM\Column(type="string", length=255, nullable=false)
35
     * @Assert\Length(max=255)
36
     */
37
    protected $configName;
38
39
    /**
40
     * Initial value of the counter
41
     *
42
     * @var integer
43
     *
44
     * @ORM\Column(type="integer", nullable=false)
45
     */
46
    protected $start = self::DEFAULT_START;
47
48
    /**
49
     * Step of the counter
50
     *
51
     * @var integer
52
     *
53
     * @ORM\Column(type="integer", nullable=false)
54
     */
55
    protected $step = self::DEFAULT_STEP;
56
57
58
    /**
59
     * Current value of the counter
60
     *
61
     * @var integer
62
     * @ORM\Column(type="integer", nullable=false)
63
     */
64
    protected $current = self::DEFAULT_START;
65
66
67
    /**
68
     * FQCN of the subject object
69
     *
70
     * @var string
71
     * @ORM\Column(type="string", length=255, nullable=false)
72
     * @Assert\Length(max=255)
73
     */
74
    protected $subjectFQCN;
75
76
    /**
77
     * Time context type e.g. "year" or  "month", if specified, current value will be determined in that context
78
     * @see TimeContext
79
     *
80
     * @var string|null
81
     * @ORM\Column(type="string", length=30, nullable=true)
82
     * @Assert\Length(max=30)
83
     */
84
    protected $timeContext;
85
86
    /**
87
     * Time context value e.g. 2019, if time context specified
88
     *
89
     * @var integer|null
90
     * @ORM\Column(type="integer", nullable=true)
91
     */
92
    protected $timeContextValue;
93
94
    /**
95
     * FQCN of the context object
96
     *
97
     * @var string|null
98
     * @ORM\Column(type="string", length=255, nullable=true)
99
     * @Assert\Length(max=255)
100
     */
101
    protected $contextObjectFQCN;
102
103
    /**
104
     * Object context value
105
     *
106
     * @var string|null
107
     * @ORM\Column(type="string", length=255, nullable=true)
108
     * @Assert\Length(max=255)
109
     */
110
    protected $contextObjectValue;
111
112
113
    /**
114
     * NumberingCounterData constructor.
115
     */
116
    public function __construct()
117
    {
118
    }
119
120
121
    public function __clone()
122
    {
123
        if ($this->getId()) {
124
            $this->id = null;
125
        }
126
    }
127
128
    /**
129
     * @return int
130
     */
131
    public function getId(): int
132
    {
133
        return $this->id;
134
    }
135
136
    /**
137
     * @param int $id
138
     * @return NumberingCounterData
139
     */
140
    public function setId(int $id): NumberingCounterData
141
    {
142
        $this->id = $id;
143
        return $this;
144
    }
145
146
    /**
147
     * @return string
148
     */
149
    public function getConfigName(): string
150
    {
151
        return $this->configName;
152
    }
153
154
    /**
155
     * @param string $configName
156
     * @return NumberingCounterData
157
     */
158
    public function setConfigName(string $configName): NumberingCounterData
159
    {
160
        $this->configName = $configName;
161
        return $this;
162
    }
163
164
    /**
165
     * @return int
166
     */
167
    public function getStart(): int
168
    {
169
        return $this->start;
170
    }
171
172
    /**
173
     * @param int $start
174
     * @return NumberingCounterData
175
     */
176
    public function setStart(int $start): NumberingCounterData
177
    {
178
        $this->start = $start;
179
        return $this;
180
    }
181
182
    /**
183
     * @return int
184
     */
185
    public function getStep(): int
186
    {
187
        return $this->step;
188
    }
189
190
    /**
191
     * @param int $step
192
     * @return NumberingCounterData
193
     */
194
    public function setStep(int $step): NumberingCounterData
195
    {
196
        $this->step = $step;
197
        return $this;
198
    }
199
200
    /**
201
     * @return int
202
     */
203
    public function getCurrent(): int
204
    {
205
        return $this->current;
206
    }
207
208
    /**
209
     * @param int $current
210
     * @return NumberingCounterData
211
     */
212
    public function setCurrent(int $current): NumberingCounterData
213
    {
214
        $this->current = $current;
215
        return $this;
216
    }
217
218
    /**
219
     * @return string
220
     */
221
    public function getSubjectFQCN(): string
222
    {
223
        return $this->subjectFQCN;
224
    }
225
226
    /**
227
     * @param string $subjectFQCN
228
     * @return NumberingCounterData
229
     */
230
    public function setSubjectFQCN(string $subjectFQCN): NumberingCounterData
231
    {
232
        $this->subjectFQCN = $subjectFQCN;
233
        return $this;
234
    }
235
236
    /**
237
     * @return string|null
238
     */
239
    public function getTimeContext(): ?string
240
    {
241
        return $this->timeContext;
242
    }
243
244
    /**
245
     * @param string|null $timeContext
246
     * @return NumberingCounterData
247
     */
248
    public function setTimeContext(?string $timeContext): NumberingCounterData
249
    {
250
        $this->timeContext = $timeContext;
251
        return $this;
252
    }
253
254
    /**
255
     * @return int|null
256
     */
257
    public function getTimeContextValue(): ?int
258
    {
259
        return $this->timeContextValue;
260
    }
261
262
    /**
263
     * @param int|null $timeContextValue
264
     * @return NumberingCounterData
265
     */
266
    public function setTimeContextValue(?int $timeContextValue): NumberingCounterData
267
    {
268
        $this->timeContextValue = $timeContextValue;
269
        return $this;
270
    }
271
272
    /**
273
     * @return string|null
274
     */
275
    public function getContextObjectFQCN(): ?string
276
    {
277
        return $this->contextObjectFQCN;
278
    }
279
280
    /**
281
     * @param string|null $contextObjectFQCN
282
     * @return NumberingCounterData
283
     */
284
    public function setContextObjectFQCN(?string $contextObjectFQCN): NumberingCounterData
285
    {
286
        $this->contextObjectFQCN = $contextObjectFQCN;
287
        return $this;
288
    }
289
290
    /**
291
     * @return string|null
292
     */
293
    public function getContextObjectValue(): ?string
294
    {
295
        return $this->contextObjectValue;
296
    }
297
298
    /**
299
     * @param string|null $contextObjectValue
300
     * @return NumberingCounterData
301
     */
302
    public function setContextObjectValue(?string $contextObjectValue): NumberingCounterData
303
    {
304
        $this->contextObjectValue = $contextObjectValue;
305
        return $this;
306
    }
307
308
309
}
310