1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Cli\Configuration |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Cli; |
22
|
|
|
|
23
|
|
|
use Psr\Log\LogLevel; |
24
|
|
|
use JMS\Serializer\Annotation\Type; |
25
|
|
|
use JMS\Serializer\Annotation\SerializedName; |
26
|
|
|
use TechDivision\Import\ConfigurationInterface; |
27
|
|
|
use TechDivision\Import\Cli\Configuration\Operation; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* A simple configuration implementation. |
31
|
|
|
* |
32
|
|
|
* @author Tim Wagner <[email protected]> |
33
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
34
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
35
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
36
|
|
|
* @link http://www.techdivision.com |
37
|
|
|
*/ |
38
|
|
|
class Configuration implements ConfigurationInterface |
39
|
|
|
{ |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Mapping for boolean values passed on the console. |
43
|
|
|
* |
44
|
|
|
* @var array |
45
|
|
|
*/ |
46
|
|
|
protected $booleanMapping = array( |
47
|
|
|
'true' => true, |
48
|
|
|
'false' => false, |
49
|
|
|
'1' => true, |
50
|
|
|
'0' => false, |
51
|
|
|
'on' => true, |
52
|
|
|
'off' => false |
53
|
|
|
); |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* The operation name to use. |
57
|
|
|
* |
58
|
|
|
* @var string |
59
|
|
|
* @Type("string") |
60
|
|
|
* @SerializedName("operation-name") |
61
|
|
|
*/ |
62
|
|
|
protected $operationName; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* The Magento edition, EE or CE. |
66
|
|
|
* |
67
|
|
|
* @var string |
68
|
|
|
* @Type("string") |
69
|
|
|
* @SerializedName("magento-edition") |
70
|
|
|
*/ |
71
|
|
|
protected $magentoEdition = 'CE'; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* The Magento version, e. g. 2.1.0. |
75
|
|
|
* |
76
|
|
|
* @var string |
77
|
|
|
* @Type("string") |
78
|
|
|
* @SerializedName("magento-version") |
79
|
|
|
*/ |
80
|
|
|
protected $magentoVersion = '2.1.2'; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* The Magento installation directory. |
84
|
|
|
* |
85
|
|
|
* @var string |
86
|
|
|
* @Type("string") |
87
|
|
|
* @SerializedName("installation-dir") |
88
|
|
|
*/ |
89
|
|
|
protected $installationDir; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* The source directory that has to be watched for new files. |
93
|
|
|
* |
94
|
|
|
* @var string |
95
|
|
|
* @Type("string") |
96
|
|
|
* @SerializedName("source-dir") |
97
|
|
|
*/ |
98
|
|
|
protected $sourceDir; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* The target directory with the files that has been imported. |
102
|
|
|
* |
103
|
|
|
* @var string |
104
|
|
|
* @Type("string") |
105
|
|
|
* @SerializedName("target-dir") |
106
|
|
|
*/ |
107
|
|
|
protected $targetDir; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* ArrayCollection with the information of the configured databases. |
111
|
|
|
* |
112
|
|
|
* @var \Doctrine\Common\Collections\ArrayCollection |
113
|
|
|
* @Type("ArrayCollection<TechDivision\Import\Cli\Configuration\Database>") |
114
|
|
|
*/ |
115
|
|
|
protected $databases; |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* ArrayCollection with the information of the configured operations. |
119
|
|
|
* |
120
|
|
|
* @var \Doctrine\Common\Collections\ArrayCollection |
121
|
|
|
* @Type("ArrayCollection<TechDivision\Import\Cli\Configuration\Operation>") |
122
|
|
|
*/ |
123
|
|
|
protected $operations; |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* The subject's utility class with the SQL statements to use. |
127
|
|
|
* |
128
|
|
|
* @var string |
129
|
|
|
* @Type("string") |
130
|
|
|
* @SerializedName("utility-class-name") |
131
|
|
|
*/ |
132
|
|
|
protected $utilityClassName; |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* The source date format to use in the subject. |
136
|
|
|
* |
137
|
|
|
* @var string |
138
|
|
|
* @Type("string") |
139
|
|
|
* @SerializedName("source-date-format") |
140
|
|
|
*/ |
141
|
|
|
protected $sourceDateFormat = 'n/d/y, g:i A'; |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* The subject's multiple field delimiter character for fields with multiple values, defaults to (,). |
145
|
|
|
* |
146
|
|
|
* @var string |
147
|
|
|
* @Type("string") |
148
|
|
|
* @SerializedName("multiple-field-delimiter") |
149
|
|
|
*/ |
150
|
|
|
protected $multipleFieldDelimiter = ','; |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* The subject's delimiter character for CSV files. |
154
|
|
|
* |
155
|
|
|
* @var string |
156
|
|
|
* @Type("string") |
157
|
|
|
*/ |
158
|
|
|
protected $delimiter; |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* The subject's enclosure character for CSV files. |
162
|
|
|
* |
163
|
|
|
* @var string |
164
|
|
|
* @Type("string") |
165
|
|
|
*/ |
166
|
|
|
protected $enclosure; |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* The subject's escape character for CSV files. |
170
|
|
|
* |
171
|
|
|
* @var string |
172
|
|
|
* @Type("string") |
173
|
|
|
*/ |
174
|
|
|
protected $escape; |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* The subject's source charset for the CSV file. |
178
|
|
|
* |
179
|
|
|
* @var string |
180
|
|
|
* @Type("string") |
181
|
|
|
* @SerializedName("from-charset") |
182
|
|
|
*/ |
183
|
|
|
protected $fromCharset; |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* The subject's target charset for a CSV file. |
187
|
|
|
* |
188
|
|
|
* @var string |
189
|
|
|
* @Type("string") |
190
|
|
|
* @SerializedName("to-charset") |
191
|
|
|
*/ |
192
|
|
|
protected $toCharset; |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* The subject's file mode for a CSV target file. |
196
|
|
|
* |
197
|
|
|
* @var string |
198
|
|
|
* @Type("string") |
199
|
|
|
* @SerializedName("file-mode") |
200
|
|
|
*/ |
201
|
|
|
protected $fileMode; |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* The flag to signal that the subject has to use the strict mode or not. |
205
|
|
|
* |
206
|
|
|
* @var boolean |
207
|
|
|
* @Type("boolean") |
208
|
|
|
* @SerializedName("strict-mode") |
209
|
|
|
*/ |
210
|
|
|
protected $strictMode; |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* The flag whether or not the import artefacts have to be archived. |
214
|
|
|
* |
215
|
|
|
* @var boolean |
216
|
|
|
* @Type("boolean") |
217
|
|
|
* @SerializedName("archive-artefacts") |
218
|
|
|
*/ |
219
|
|
|
protected $archiveArtefacts; |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* The directory where the archives will be stored. |
223
|
|
|
* |
224
|
|
|
* @var string |
225
|
|
|
* @Type("string") |
226
|
|
|
* @SerializedName("archive-dir") |
227
|
|
|
*/ |
228
|
|
|
protected $archiveDir; |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* The flag to signal that the subject has to use the debug mode or not. |
232
|
|
|
* |
233
|
|
|
* @var boolean |
234
|
|
|
* @Type("boolean") |
235
|
|
|
* @SerializedName("debug-mode") |
236
|
|
|
*/ |
237
|
|
|
protected $debugMode = false; |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* The flag to signal that the an existing PID should be ignored, whether or import process is running or not. |
241
|
|
|
* |
242
|
|
|
* @var boolean |
243
|
|
|
* @Type("boolean") |
244
|
|
|
* @SerializedName("ignore-pid") |
245
|
|
|
*/ |
246
|
|
|
protected $ignorePid = false; |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* The log level to use (see Monolog documentation). |
250
|
|
|
* |
251
|
|
|
* @var string |
252
|
|
|
* @Type("string") |
253
|
|
|
* @SerializedName("log-level") |
254
|
|
|
*/ |
255
|
|
|
protected $logLevel = LogLevel::INFO; |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* Return's the array with the subjects of the operation to use. |
259
|
|
|
* |
260
|
|
|
* @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the subjects |
261
|
|
|
* @throws \Exception Is thrown, if no subjects are available for the actual operation |
262
|
|
|
*/ |
263
|
|
|
public function getSubjects() |
264
|
|
|
{ |
265
|
|
|
|
266
|
|
|
// iterate over the operations and return the subjects of the actual one |
267
|
|
|
/** @var TechDivision\Import\Configuration\OperationInterface $operation */ |
268
|
|
|
foreach ($this->getOperations() as $operation) { |
269
|
|
|
if ($this->getOperation()->equals($operation)) { |
270
|
|
|
return $operation->getSubjects(); |
271
|
|
|
} |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
// throw an exception if no subjects are available |
275
|
|
|
throw new \Exception(sprintf('Can\'t find any subjects for operation %s', $this->getOperation())); |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* Map's the passed value to a boolean. |
280
|
|
|
* |
281
|
|
|
* @param string $value The value to map |
282
|
|
|
* |
283
|
|
|
* @return boolean The mapped value |
284
|
|
|
* @throws \Exception Is thrown, if the value can't be mapped |
285
|
|
|
*/ |
286
|
|
|
public function mapBoolean($value) |
287
|
|
|
{ |
288
|
|
|
|
289
|
|
|
// try to map the passed value to a boolean |
290
|
|
|
if (isset($this->booleanMapping[$value])) { |
291
|
|
|
return $this->booleanMapping[$value]; |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
// throw an exception if we can't convert the passed value |
295
|
|
|
throw new \Exception(sprintf('Can\'t convert %s to boolean', $value)); |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* Return's the operation, initialize from the actual operation name. |
300
|
|
|
* |
301
|
|
|
* @return \TechDivision\Import\Configuration\OperationInterface The operation instance |
302
|
|
|
*/ |
303
|
|
|
protected function getOperation() |
304
|
|
|
{ |
305
|
|
|
return new Operation($this->getOperationName()); |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* Return's the operation name that has to be used. |
310
|
|
|
* |
311
|
|
|
* @param string $operationName The operation name that has to be used |
312
|
|
|
* |
313
|
|
|
* @return void |
314
|
|
|
*/ |
315
|
|
|
public function setOperationName($operationName) |
316
|
|
|
{ |
317
|
|
|
return $this->operationName = $operationName; |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
/** |
321
|
|
|
* Return's the operation name that has to be used. |
322
|
|
|
* |
323
|
|
|
* @return string The operation name that has to be used |
324
|
|
|
*/ |
325
|
|
|
public function getOperationName() |
326
|
|
|
{ |
327
|
|
|
return $this->operationName; |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
/** |
331
|
|
|
* Set's the Magento installation directory. |
332
|
|
|
* |
333
|
|
|
* @param string $installationDir The Magento installation directory |
334
|
|
|
* |
335
|
|
|
* @return void |
336
|
|
|
*/ |
337
|
|
|
public function setInstallationDir($installationDir) |
338
|
|
|
{ |
339
|
|
|
$this->installationDir = $installationDir; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* Return's the Magento installation directory. |
344
|
|
|
* |
345
|
|
|
* @return string The Magento installation directory |
346
|
|
|
*/ |
347
|
|
|
public function getInstallationDir() |
348
|
|
|
{ |
349
|
|
|
return $this->installationDir; |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* Set's the source directory that has to be watched for new files. |
354
|
|
|
* |
355
|
|
|
* @param string $sourceDir The source directory |
356
|
|
|
* |
357
|
|
|
* @return void |
358
|
|
|
*/ |
359
|
|
|
public function setSourceDir($sourceDir) |
360
|
|
|
{ |
361
|
|
|
$this->sourceDir = $sourceDir; |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* Return's the source directory that has to be watched for new files. |
366
|
|
|
* |
367
|
|
|
* @return string The source directory |
368
|
|
|
*/ |
369
|
|
|
public function getSourceDir() |
370
|
|
|
{ |
371
|
|
|
return $this->sourceDir; |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
/** |
375
|
|
|
* Return's the target directory with the files that has been imported. |
376
|
|
|
* |
377
|
|
|
* @return string The target directory |
378
|
|
|
*/ |
379
|
|
|
public function getTargetDir() |
380
|
|
|
{ |
381
|
|
|
return $this->targetDir; |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
/** |
385
|
|
|
* Set's the target directory with the files that has been imported. |
386
|
|
|
* |
387
|
|
|
* @param string $targetDir The target directory |
388
|
|
|
* |
389
|
|
|
* @return void |
390
|
|
|
*/ |
391
|
|
|
public function setTargetDir($targetDir) |
392
|
|
|
{ |
393
|
|
|
$this->targetDir = $targetDir; |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
/** |
397
|
|
|
* Return's the utility class with the SQL statements to use. |
398
|
|
|
* |
399
|
|
|
* @param string $utilityClassName The utility class name |
400
|
|
|
* |
401
|
|
|
* @return void |
402
|
|
|
*/ |
403
|
|
|
public function setUtilityClassName($utilityClassName) |
404
|
|
|
{ |
405
|
|
|
return $this->utilityClassName = $utilityClassName; |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
/** |
409
|
|
|
* Return's the utility class with the SQL statements to use. |
410
|
|
|
* |
411
|
|
|
* @return string The utility class name |
412
|
|
|
*/ |
413
|
|
|
public function getUtilityClassName() |
414
|
|
|
{ |
415
|
|
|
return $this->utilityClassName; |
416
|
|
|
} |
417
|
|
|
|
418
|
|
|
/** |
419
|
|
|
* Set's the Magento edition, EE or CE. |
420
|
|
|
* |
421
|
|
|
* @param string $magentoEdition The Magento edition |
422
|
|
|
* |
423
|
|
|
* @return void |
424
|
|
|
*/ |
425
|
|
|
public function setMagentoEdition($magentoEdition) |
426
|
|
|
{ |
427
|
|
|
$this->magentoEdition = $magentoEdition; |
428
|
|
|
} |
429
|
|
|
|
430
|
|
|
/** |
431
|
|
|
* Return's the Magento edition, EE or CE. |
432
|
|
|
* |
433
|
|
|
* @return string The Magento edition |
434
|
|
|
*/ |
435
|
|
|
public function getMagentoEdition() |
436
|
|
|
{ |
437
|
|
|
return $this->magentoEdition; |
438
|
|
|
} |
439
|
|
|
|
440
|
|
|
/** |
441
|
|
|
* Return's the Magento version, e. g. 2.1.0. |
442
|
|
|
* |
443
|
|
|
* @param string $magentoVersion The Magento version |
444
|
|
|
* |
445
|
|
|
* @return void |
446
|
|
|
*/ |
447
|
|
|
public function setMagentoVersion($magentoVersion) |
448
|
|
|
{ |
449
|
|
|
$this->magentoVersion = $magentoVersion; |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
/** |
453
|
|
|
* Return's the Magento version, e. g. 2.1.0. |
454
|
|
|
* |
455
|
|
|
* @return string The Magento version |
456
|
|
|
*/ |
457
|
|
|
public function getMagentoVersion() |
458
|
|
|
{ |
459
|
|
|
return $this->magentoVersion; |
460
|
|
|
} |
461
|
|
|
|
462
|
|
|
/** |
463
|
|
|
* Return's the subject's source date format to use. |
464
|
|
|
* |
465
|
|
|
* @return string The source date format |
466
|
|
|
*/ |
467
|
|
|
public function getSourceDateFormat() |
468
|
|
|
{ |
469
|
|
|
return $this->sourceDateFormat; |
470
|
|
|
} |
471
|
|
|
|
472
|
|
|
/** |
473
|
|
|
* Set's the subject's source date format to use. |
474
|
|
|
* |
475
|
|
|
* @param string $sourceDateFormat The source date format |
476
|
|
|
* |
477
|
|
|
* @return void |
478
|
|
|
*/ |
479
|
|
|
public function setSourceDateFormat($sourceDateFormat) |
480
|
|
|
{ |
481
|
|
|
$this->sourceDateFormat = $sourceDateFormat; |
482
|
|
|
} |
483
|
|
|
|
484
|
|
|
/** |
485
|
|
|
* Return's the multiple field delimiter character to use, default value is comma (,). |
486
|
|
|
* |
487
|
|
|
* @return string The multiple field delimiter character |
488
|
|
|
*/ |
489
|
|
|
public function getMultipleFieldDelimiter() |
490
|
|
|
{ |
491
|
|
|
return $this->multipleFieldDelimiter; |
492
|
|
|
} |
493
|
|
|
|
494
|
|
|
/** |
495
|
|
|
* Return's the delimiter character to use, default value is comma (,). |
496
|
|
|
* |
497
|
|
|
* @return string The delimiter character |
498
|
|
|
*/ |
499
|
|
|
public function getDelimiter() |
500
|
|
|
{ |
501
|
|
|
return $this->delimiter; |
502
|
|
|
} |
503
|
|
|
|
504
|
|
|
/** |
505
|
|
|
* The enclosure character to use, default value is double quotation ("). |
506
|
|
|
* |
507
|
|
|
* @return string The enclosure character |
508
|
|
|
*/ |
509
|
|
|
public function getEnclosure() |
510
|
|
|
{ |
511
|
|
|
return $this->enclosure; |
512
|
|
|
} |
513
|
|
|
|
514
|
|
|
/** |
515
|
|
|
* The escape character to use, default value is backslash (\). |
516
|
|
|
* |
517
|
|
|
* @return string The escape character |
518
|
|
|
*/ |
519
|
|
|
public function getEscape() |
520
|
|
|
{ |
521
|
|
|
return $this->escape; |
522
|
|
|
} |
523
|
|
|
|
524
|
|
|
/** |
525
|
|
|
* The file encoding of the CSV source file, default value is UTF-8. |
526
|
|
|
* |
527
|
|
|
* @return string The charset used by the CSV source file |
528
|
|
|
*/ |
529
|
|
|
public function getFromCharset() |
530
|
|
|
{ |
531
|
|
|
return $this->fromCharset; |
532
|
|
|
} |
533
|
|
|
|
534
|
|
|
/** |
535
|
|
|
* The file encoding of the CSV targetfile, default value is UTF-8. |
536
|
|
|
* |
537
|
|
|
* @return string The charset used by the CSV target file |
538
|
|
|
*/ |
539
|
|
|
public function getToCharset() |
540
|
|
|
{ |
541
|
|
|
return $this->toCharset; |
542
|
|
|
} |
543
|
|
|
|
544
|
|
|
/** |
545
|
|
|
* The file mode of the CSV target file, either one of write or append, default is write. |
546
|
|
|
* |
547
|
|
|
* @return string The file mode of the CSV target file |
548
|
|
|
*/ |
549
|
|
|
public function getFileMode() |
550
|
|
|
{ |
551
|
|
|
return $this->fileMode; |
552
|
|
|
} |
553
|
|
|
|
554
|
|
|
/** |
555
|
|
|
* Queries whether or not strict mode is enabled or not, default is TRUE. |
556
|
|
|
* |
557
|
|
|
* @return boolean TRUE if strict mode is enabled, else FALSE |
558
|
|
|
*/ |
559
|
|
|
public function isStrictMode() |
560
|
|
|
{ |
561
|
|
|
return $this->strictMode; |
562
|
|
|
} |
563
|
|
|
|
564
|
|
|
/** |
565
|
|
|
* Return's the database configuration. |
566
|
|
|
* |
567
|
|
|
* @param string $id The ID of the database connection to return |
568
|
|
|
* |
569
|
|
|
* @return \TechDivision\Import\Cli\Configuration\Database The database configuration |
570
|
|
|
* @throws \Exception Is thrown, if the database with the passed ID is not configured |
571
|
|
|
*/ |
572
|
|
|
public function getDatabase($id = null) |
573
|
|
|
{ |
574
|
|
|
|
575
|
|
|
// if no ID has been passed, try to load the default database |
576
|
|
|
if ($id === null) { |
577
|
|
|
// iterate over the configured databases and return the default database |
578
|
|
|
/** @var TechDivision\Import\Configuration\DatabaseInterface $database */ |
579
|
|
|
foreach ($this->databases as $database) { |
580
|
|
|
if ($database->isDefault()) { |
581
|
|
|
return $database; |
582
|
|
|
} |
583
|
|
|
} |
584
|
|
|
} |
585
|
|
|
|
586
|
|
|
// iterate over the configured databases and return the one with the passed ID |
587
|
|
|
/** @var TechDivision\Import\Configuration\DatabaseInterface $database */ |
588
|
|
|
foreach ($this->databases as $database) { |
589
|
|
|
if ($database->getId() === $id) { |
590
|
|
|
return $database; |
591
|
|
|
} |
592
|
|
|
} |
593
|
|
|
|
594
|
|
|
// throw an exception, if the database with the passed ID is NOT configured |
595
|
|
|
throw new \Exception(sprintf('Database with ID %s can not be found', $id)); |
596
|
|
|
} |
597
|
|
|
|
598
|
|
|
/** |
599
|
|
|
* Return's the ArrayCollection with the configured operations. |
600
|
|
|
* |
601
|
|
|
* @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the operations |
602
|
|
|
*/ |
603
|
|
|
public function getOperations() |
604
|
|
|
{ |
605
|
|
|
return $this->operations; |
606
|
|
|
} |
607
|
|
|
|
608
|
|
|
/** |
609
|
|
|
* Return's the TRUE if the import artefacts have to be archived. |
610
|
|
|
* |
611
|
|
|
* @return boolean TRUE if the import artefacts have to be archived |
612
|
|
|
*/ |
613
|
|
|
public function haveArchiveArtefacts() |
614
|
|
|
{ |
615
|
|
|
return $this->archiveArtefacts; |
616
|
|
|
} |
617
|
|
|
|
618
|
|
|
/** |
619
|
|
|
* The directory where the archives will be stored. |
620
|
|
|
* |
621
|
|
|
* @return string The archive directory |
622
|
|
|
*/ |
623
|
|
|
public function getArchiveDir() |
624
|
|
|
{ |
625
|
|
|
return $this->archiveDir; |
626
|
|
|
} |
627
|
|
|
|
628
|
|
|
/** |
629
|
|
|
* Set's the debug mode. |
630
|
|
|
* |
631
|
|
|
* @param boolean $debugMode TRUE if debug mode is enabled, else FALSE |
632
|
|
|
* |
633
|
|
|
* @return void |
634
|
|
|
*/ |
635
|
|
|
public function setDebugMode($debugMode) |
636
|
|
|
{ |
637
|
|
|
$this->debugMode = $debugMode; |
638
|
|
|
} |
639
|
|
|
|
640
|
|
|
/** |
641
|
|
|
* Queries whether or not debug mode is enabled or not, default is TRUE. |
642
|
|
|
* |
643
|
|
|
* @return boolean TRUE if debug mode is enabled, else FALSE |
644
|
|
|
*/ |
645
|
|
|
public function isDebugMode() |
646
|
|
|
{ |
647
|
|
|
return $this->debugMode; |
648
|
|
|
} |
649
|
|
|
|
650
|
|
|
/** |
651
|
|
|
* Set's the flag to signal that the an existing PID hast to be ignored, whether a |
652
|
|
|
* import process is running or not. |
653
|
|
|
* |
654
|
|
|
* @param boolean $ignorePid TRUE if the PID has to be ignored, else FALSE |
655
|
|
|
* |
656
|
|
|
* @return void |
657
|
|
|
*/ |
658
|
|
|
public function setIgnorePid($ignorePid) |
659
|
|
|
{ |
660
|
|
|
$this->ignorePid = $ignorePid; |
661
|
|
|
} |
662
|
|
|
|
663
|
|
|
/** |
664
|
|
|
* Queries whether or not that the an existing PID has to be ignored. |
665
|
|
|
* |
666
|
|
|
* @return boolean TRUE if an existing PID has to be ignored, else FALSE |
667
|
|
|
*/ |
668
|
|
|
public function isIgnorePid() |
669
|
|
|
{ |
670
|
|
|
return $this->ignorePid; |
671
|
|
|
} |
672
|
|
|
|
673
|
|
|
/** |
674
|
|
|
* Set's the log level to use. |
675
|
|
|
* |
676
|
|
|
* @param string $logLevel The log level to use |
677
|
|
|
* |
678
|
|
|
* @return void |
679
|
|
|
*/ |
680
|
|
|
public function setLogLevel($logLevel) |
681
|
|
|
{ |
682
|
|
|
$this->logLevel = $logLevel; |
683
|
|
|
} |
684
|
|
|
|
685
|
|
|
/** |
686
|
|
|
* Return's the log level to use. |
687
|
|
|
* |
688
|
|
|
* @return string The log level to use |
689
|
|
|
*/ |
690
|
|
|
public function getLogLevel() |
691
|
|
|
{ |
692
|
|
|
return $this->logLevel; |
693
|
|
|
} |
694
|
|
|
} |
695
|
|
|
|