Completed
Push — master ( 51a3ff...6bd1de )
by Tim
02:02 queued 10s
created

Configuration::getCategoryDelimiter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * TechDivision\Import\Configuration\Jms\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-configuration-jms
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Configuration\Jms;
22
23
use Doctrine\Common\Collections\ArrayCollection;
24
use JMS\Serializer\Annotation\Type;
25
use JMS\Serializer\Annotation\Exclude;
26
use JMS\Serializer\Annotation\Accessor;
27
use JMS\Serializer\Annotation\SerializedName;
28
use JMS\Serializer\Annotation\PostDeserialize;
29
use JMS\Serializer\Annotation\ExclusionPolicy;
30
use TechDivision\Import\Configuration\ConfigurationInterface;
31
use TechDivision\Import\Configuration\DatabaseConfigurationInterface;
32
use TechDivision\Import\Configuration\Jms\Configuration\ParamsTrait;
33
use TechDivision\Import\Configuration\Jms\Configuration\CsvTrait;
34
use TechDivision\Import\Configuration\Jms\Configuration\ListenersTrait;
35
use TechDivision\Import\Configuration\ListenerAwareConfigurationInterface;
36
use TechDivision\Import\Configuration\OperationConfigurationInterface;
37
38
/**
39
 * A simple JMS based configuration implementation.
40
 *
41
 * @author    Tim Wagner <[email protected]>
42
 * @copyright 2016 TechDivision GmbH <[email protected]>
43
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
44
 * @link      https://github.com/techdivision/import-configuration-jms
45
 * @link      http://www.techdivision.com
46
 *
47
 * @ExclusionPolicy("none")
48
 */
49
class Configuration implements
50
    ConfigurationInterface,
51
    ListenerAwareConfigurationInterface,
52
    \TechDivision\Import\Cache\Configuration\ConfigurationInterface,
53
    \TechDivision\Import\Dbal\Configuration\ConfigurationInterface,
54
    \TechDivision\Import\Serializer\Configuration\ConfigurationInterface,
55
    \TechDivision\Import\Serializer\Configuration\SerializerConfigurationInterface
56
{
57
58
    /**
59
     * The default PID filename to use.
60
     *
61
     * @var string
62
     */
63
    const PID_FILENAME = 'importer.pid';
64
65
    /**
66
     * Trait that provides CSV configuration functionality.
67
     *
68
     * @var \TechDivision\Import\Configuration\Jms\Configuration\CsvTrait
69
     */
70
    use CsvTrait;
71
72
    /**
73
     * Trait that provides CSV configuration functionality.
74
     *
75
     * @var \TechDivision\Import\Configuration\Jms\Configuration\ParamsTrait
76
     */
77
    use ParamsTrait;
78
79
    /**
80
     * Trait that provides CSV configuration functionality.
81
     *
82
     * @var \TechDivision\Import\Configuration\Jms\Configuration\ListenersTrait
83
     */
84
    use ListenersTrait;
85
86
    /**
87
     * The array with the available database types.
88
     *
89
     * @var array
90
     * @Exclude
91
     */
92
    protected $availableDatabaseTypes = array(
93
        DatabaseConfigurationInterface::TYPE_MYSQL,
94
        DatabaseConfigurationInterface::TYPE_REDIS
95
    );
96
97
    /**
98
     * The operation names to be executed.
99
     *
100
     * @var array
101
     * @Exclude
102
     */
103
    protected $operationNames = array();
104
105
    /**
106
     * Mapping for boolean values passed on the console.
107
     *
108
     * @var array
109
     * @Exclude
110
     */
111
    protected $booleanMapping = array(
112
        'true'  => true,
113
        'false' => false,
114
        '1'     => true,
115
        '0'     => false,
116
        'on'    => true,
117
        'off'   => false
118
    );
119
120
    /**
121
     * The serial that will be passed as commandline option (can not be specified in configuration file).
122
     *
123
     * @var string
124
     * @Exclude
125
     * @Accessor(setter="setSerial", getter="getSerial")
126
     */
127
    protected $serial;
128
129
    /**
130
     * The shortcut that maps the operation names that has to be executed.
131
     *
132
     * @var string
133
     * @Exclude
134
     */
135
    protected $shortcut;
136
137
    /**
138
     * The prefix for the move files subject.
139
     *
140
     * @var string
141
     * @Exclude
142
     * @SerializedName("move-files-prefix")
143
     * @Accessor(setter="setMoveFilesPrefix", getter="getMoveFilesPrefix")
144
     */
145
    protected $moveFilesPrefix;
146
147
    /**
148
     * The name of the command that has been invoked.
149
     *
150
     * @var string
151
     * @Exclude
152
     */
153
    protected $commandName;
154
155
    /**
156
     * The application's unique DI identifier.
157
     *
158
     * @var string
159
     * @Type("string")
160
     * @SerializedName("id")
161
     */
162
    protected $id;
163
164
    /**
165
     * The system name to use.
166
     *
167
     * @var string
168
     * @Type("string")
169
     * @SerializedName("system-name")
170
     * @Accessor(setter="setSystemName", getter="getSystemName")
171
     */
172
    protected $systemName;
173
174
    /**
175
     * The entity type code to use.
176
     *
177
     * @var string
178
     * @Type("string")
179
     * @SerializedName("entity-type-code")
180
     */
181
    protected $entityTypeCode;
182
183
    /**
184
     * The Magento installation directory.
185
     *
186
     * @var string
187
     * @Type("string")
188
     * @SerializedName("installation-dir")
189
     * @Accessor(setter="setInstallationDir", getter="getInstallationDir")
190
     */
191
    protected $installationDir;
192
193
    /**
194
     * The source directory that has to be watched for new files.
195
     *
196
     * @var string
197
     * @Type("string")
198
     * @SerializedName("source-dir")
199
     * @Accessor(setter="setSourceDir", getter="getSourceDir")
200
     */
201
    protected $sourceDir;
202
203
    /**
204
     * The target directory with the files that has been imported.
205
     *
206
     * @var string
207
     * @Type("string")
208
     * @SerializedName("target-dir")
209
     * @Accessor(setter="setTargetDir", getter="getTargetDir")
210
     */
211
    protected $targetDir;
212
213
    /**
214
     * The Magento edition, EE or CE.
215
     *
216
     * @var string
217
     * @Type("string")
218
     * @SerializedName("magento-edition")
219
     * @Accessor(setter="setMagentoEdition", getter="getMagentoEdition")
220
     */
221
    protected $magentoEdition = 'CE';
222
223
    /**
224
     * The Magento version, e. g. 2.2.0.
225
     *
226
     * @var string
227
     * @Type("string")
228
     * @SerializedName("magento-version")
229
     * @Accessor(setter="setMagentoVersion", getter="getMagentoVersion")
230
     */
231
    protected $magentoVersion = '2.2.0';
232
233
    /**
234
     * ArrayCollection with the information of the configured databases.
235
     *
236
     * @var \Doctrine\Common\Collections\ArrayCollection
237
     * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Database>")
238
     */
239
    protected $databases;
240
241
    /**
242
     * ArrayCollection with the information of the configured loggers.
243
     *
244
     * @var \Doctrine\Common\Collections\ArrayCollection
245
     * @Type("ArrayCollection<string, TechDivision\Import\Configuration\Jms\Configuration\Logger>")
246
     */
247
    protected $loggers;
248
249
    /**
250
     * The subject's multiple field delimiter character for fields with multiple values, defaults to (,).
251
     *
252
     * @var string
253
     * @Type("string")
254
     * @SerializedName("multiple-field-delimiter")
255
     */
256
    protected $multipleFieldDelimiter = ',';
257
258
    /**
259
     * The subject's multiple value delimiter character for fields with multiple values, defaults to (|).
260
     *
261
     * @var string
262
     * @Type("string")
263
     * @SerializedName("multiple-value-delimiter")
264
     */
265
    protected $multipleValueDelimiter = '|';
266
267
    /**
268
     * The subject's delimiter character for categories, defaults to (/).
269
     *
270
     * @var string
271
     * @Type("string")
272
     * @SerializedName("category-delimiter")
273
     */
274
    protected $categoryDelimiter = '/';
275
276
    /**
277
     * The flag to signal that the subject has to use the strict mode or not.
278
     *
279
     * @var boolean
280
     * @Type("boolean")
281
     * @SerializedName("strict-mode")
282
     */
283
    protected $strictMode;
284
285
    /**
286
     * The flag whether or not the import artefacts have to be archived.
287
     *
288
     * @var boolean
289
     * @Type("boolean")
290
     * @SerializedName("archive-artefacts")
291
     * @Accessor(setter="setArchiveArtefacts", getter="haveArchiveArtefacts")
292
     */
293
    protected $archiveArtefacts = true;
294
295
    /**
296
     * The flag whether or not the import artefacts have to be cleared.
297
     *
298
     * @var boolean
299
     * @Type("boolean")
300
     * @SerializedName("clear-artefacts")
301
     * @Accessor(setter="setClearArtefacts", getter="haveClearArtefacts")
302
     */
303
    protected $clearArtefacts = true;
304
305
    /**
306
     * The directory where the archives will be stored.
307
     *
308
     * @var string
309
     * @Type("string")
310
     * @SerializedName("archive-dir")
311
     * @Accessor(setter="setArchiveDir", getter="getArchiveDir")
312
     */
313
    protected $archiveDir;
314
315
    /**
316
     * The flag to signal that the subject has to use the debug mode or not.
317
     *
318
     * @var boolean
319
     * @Type("boolean")
320
     * @SerializedName("debug-mode")
321
     * @Accessor(setter="setDebugMode", getter="isDebugMode")
322
     */
323
    protected $debugMode = false;
324
325
    /**
326
     * The log level to use (see Monolog documentation).
327
     *
328
     * @var string
329
     * @Type("string")
330
     * @SerializedName("log-level")
331
     * @Accessor(setter="setLogLevel", getter="getLogLevel")
332
     */
333
    protected $logLevel;
334
335
    /**
336
     * The explicit DB ID to use.
337
     *
338
     * @var string
339
     * @Type("string")
340
     * @SerializedName("use-db-id")
341
     */
342
    protected $useDbId;
343
344
    /**
345
     * The explicit PID filename to use.
346
     *
347
     * @var string
348
     * @Type("string")
349
     * @SerializedName("pid-filename")
350
     * @Accessor(setter="setPidFilename", getter="getPidFilename")
351
     */
352
    protected $pidFilename;
353
354
    /**
355
     * The collection with the paths to additional vendor directories.
356
     *
357
     * @var \Doctrine\Common\Collections\ArrayCollection
358
     * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\VendorDir>")
359
     * @SerializedName("additional-vendor-dirs")
360
     */
361
    protected $additionalVendorDirs;
362
363
    /**
364
     * ArrayCollection with the information of the configured operations.
365
     *
366
     * @var array
367
     * @Type("array<string, array<string, ArrayCollection<string, TechDivision\Import\Configuration\Jms\Configuration\Operation>>>")
368
     */
369
    protected $operations = array();
370
371
    /**
372
     * The array with the Magento Edition specific extension libraries.
373
     *
374
     * @var array
375
     * @Type("array")
376
     * @SerializedName("extension-libraries")
377
     */
378
    protected $extensionLibraries = array();
379
380
    /**
381
     * The array with the custom header mappings.
382
     *
383
     * @var array
384
     * @SerializedName("header-mappings")
385
     * @Type("array<string, array<string, string>>")
386
     */
387
    protected $headerMappings = array();
388
389
    /**
390
     * The array with the custom image types.
391
     *
392
     * @var array
393
     * @Type("array")
394
     * @SerializedName("image-types")
395
     */
396
    protected $imageTypes = array();
397
398
    /**
399
     * The flag to signal that the import should be wrapped within a single transation or not.
400
     *
401
     * @var boolean
402
     * @Type("boolean")
403
     * @SerializedName("single-transaction")
404
     * @Accessor(setter="setSingleTransaction", getter="isSingleTransaction")
405
     */
406
    protected $singleTransaction = false;
407
408
    /**
409
     * The flag to signal that the cache should be enabled or not.
410
     *
411
     * @var boolean
412
     * @Type("boolean")
413
     * @SerializedName("cache-enabled")
414
     * @Accessor(setter="setCacheEnabled", getter="isCacheEnabled")
415
     */
416
    protected $cacheEnabled = false;
417
418
    /**
419
     * ArrayCollection with the information of the configured aliases.
420
     *
421
     * @var \Doctrine\Common\Collections\ArrayCollection
422
     * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Alias>")
423
     */
424
    protected $aliases;
425
426
    /**
427
     * ArrayCollection with the information of the configured caches.
428
     *
429
     * @var \Doctrine\Common\Collections\ArrayCollection
430
     * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Cache>")
431
     */
432
    protected $caches;
433
434
    /**
435
     * The array with the shortcuts.
436
     *
437
     * @var array
438
     * @Type("array<string, array<string, array>>")
439
     * @SerializedName("shortcuts")
440
     */
441
    protected $shortcuts = array();
442
443
    /**
444
     * The username to save the import history with.
445
     *
446
     * @var string
447
     * @Type("string")
448
     */
449
    protected $username;
450
451
    /**
452
     * The array with the finder mappings.
453
     *
454
     * @var array
455
     * @SerializedName("finder-mappings")
456
     * @Type("array<string, array<string, string>>")
457
     * @Accessor(setter="setFinderMappings", getter="getFinderMappings")
458
     */
459
    protected $finderMappings = array();
460
461
    /**
462
     * The array with the default values.
463
     *
464
     * @var array
465
     * @SerializedName("default-values")
466
     * @Type("array<string, array<string, string>>")
467
     * @Accessor(setter="setDefaultValues", getter="getDefaultValues")
468
     */
469
    protected $defaultValues = array();
470
471
    /**
472
     * The value to define empty values for attributes
473
     *
474
     * @var string
475
     * @Type("string")
476
     * @SerializedName("empty-attribute-value-constant")
477
     * @Accessor(setter="setEmptyAttributeValueConstant", getter="getEmptyAttributeValueConstant")
478
     */
479
    protected $emptyAttributeValueConstant = '';
480
481
    /**
482
     * Lifecycle callback that will be invoked after deserialization.
483
     *
484
     * @return void
485
     * @PostDeserialize
486
     */
487
    public function postDeserialize()
488
    {
489
490
        // create an empty collection if no loggers has been specified
491
        if ($this->loggers === null) {
492
            $this->loggers = new ArrayCollection();
493
        }
494
495
        // create an empty collection if no caches has been specified
496
        if ($this->caches === null) {
497
            $this->caches = new ArrayCollection();
498
        }
499
500
        // create an empty collection if no aliases has been specified
501
        if ($this->aliases === null) {
502
            $this->aliases = new ArrayCollection();
503
        }
504
505
        // create an empty collection if no databases has been specified
506
        if ($this->databases === null) {
507
            $this->databases = new ArrayCollection();
508
        }
509
510
        // create an empty collection if no additional venor directories has been specified
511
        if ($this->additionalVendorDirs === null) {
512
            $this->additionalVendorDirs = new ArrayCollection();
513
        }
514
    }
515
516
    /**
517
     * Map's the passed value to a boolean.
518
     *
519
     * @param string $value The value to map
520
     *
521
     * @return boolean The mapped value
522
     * @throws \Exception Is thrown, if the value can't be mapped
523
     */
524
    public function mapBoolean($value)
525
    {
526
527
        // do nothing, because passed value is already a boolean
528
        if (is_bool($value)) {
529
            return $value;
530
        }
531
532
        // try to map the passed value to a boolean
533
        if (isset($this->booleanMapping[$val = strtolower($value)])) {
534
            return $this->booleanMapping[$val];
535
        }
536
537
        // throw an exception if we can't convert the passed value
538
        throw new \Exception(sprintf('Can\'t convert %s to boolean', $value));
539
    }
540
541
    /**
542
     * Return's the application's unique DI identifier.
543
     *
544
     * @return string The application's unique DI identifier
545
     */
546
    public function getId()
547
    {
548
        return $this->id;
549
    }
550
551
    /**
552
     * Add's the operation with the passed name ot the operations that has to be executed.
553
     *
554
     * If the operation name has already been added, it'll not be added again.
555
     *
556
     * @param string  $operationName The operation to be executed
557
     * @param boolean $prepend       TRUE if the operation name should be prepended, else FALSE
558
     *
559
     * @return void
560
     */
561
    public function addOperationName($operationName, $prepend = false)
562
    {
563
564
        // do nothing if the operation has already been added
565
        if (in_array($operationName, $this->operationNames)) {
566
            return;
567
        }
568
569
        // add the operation otherwise
570
        $prepend ? array_unshift($this->operationNames, $operationName) : array_push($this->operationNames, $operationName);
571
    }
572
573
    /**
574
     * Return's the operation names that has to be executed.
575
     *
576
     * @param array $operationNames The operation names that has to be executed
577
     *
578
     * @return void
579
     */
580
    public function setOperationNames(array $operationNames)
581
    {
582
        return $this->operationNames = $operationNames;
583
    }
584
585
    /**
586
     * Return's the operation names that has to be executed.
587
     *
588
     * @return array The operation names that has to be executed
589
     */
590
    public function getOperationNames()
591
    {
592
        return $this->operationNames;
593
    }
594
595
    /**
596
     * Queries whether or not the passed operation has to be exceuted or not.
597
     *
598
     * @param \TechDivision\Import\Configuration\OperationConfigurationInterface $operation The operation to query for
599
     *
600
     * @return boolean TRUE if the operation has to be executed, else FALSE
601
     */
602
    public function inOperationNames(OperationConfigurationInterface $operation)
603
    {
604
        return in_array($operation->getName(), $this->getOperationNames());
605
    }
606
607
    /**
608
     * Set's the Magento installation directory.
609
     *
610
     * @param string $installationDir The Magento installation directory
611
     *
612
     * @return void
613
     */
614
    public function setInstallationDir($installationDir)
615
    {
616
        $this->installationDir = $installationDir;
617
    }
618
619
    /**
620
     * Return's the Magento installation directory.
621
     *
622
     * @return string The Magento installation directory
623
     */
624
    public function getInstallationDir()
625
    {
626
        return $this->installationDir;
627
    }
628
629
    /**
630
     * Set's the source directory that has to be watched for new files.
631
     *
632
     * @param string $sourceDir The source directory
633
     *
634
     * @return void
635
     */
636
    public function setSourceDir($sourceDir)
637
    {
638
        $this->sourceDir = $sourceDir;
639
    }
640
641
    /**
642
     * Return's the source directory that has to be watched for new files.
643
     *
644
     * @return string The source directory
645
     */
646
    public function getSourceDir()
647
    {
648
        return $this->sourceDir;
649
    }
650
651
    /**
652
     * Set's the target directory with the files that has been imported.
653
     *
654
     * @param string $targetDir The target directory
655
     *
656
     * @return void
657
     */
658
    public function setTargetDir($targetDir)
659
    {
660
        $this->targetDir = $targetDir;
661
    }
662
663
    /**
664
     * Return's the target directory with the files that has been imported.
665
     *
666
     * @return string The target directory
667
     */
668
    public function getTargetDir()
669
    {
670
        return $this->targetDir;
671
    }
672
673
    /**
674
     * Set's the Magento edition, EE or CE.
675
     *
676
     * @param string $magentoEdition The Magento edition
677
     *
678
     * @return void
679
     */
680
    public function setMagentoEdition($magentoEdition)
681
    {
682
        $this->magentoEdition = $magentoEdition;
683
    }
684
685
    /**
686
     * Return's the Magento edition, EE or CE.
687
     *
688
     * @return string The Magento edition
689
     */
690
    public function getMagentoEdition()
691
    {
692
        return $this->magentoEdition;
693
    }
694
695
    /**
696
     * Return's the Magento version, e. g. 2.1.0.
697
     *
698
     * @param string $magentoVersion The Magento version
699
     *
700
     * @return void
701
     */
702
    public function setMagentoVersion($magentoVersion)
703
    {
704
        $this->magentoVersion = $magentoVersion;
705
    }
706
707
    /**
708
     * Return's the Magento version, e. g. 2.1.0.
709
     *
710
     * @return string The Magento version
711
     */
712
    public function getMagentoVersion()
713
    {
714
        return $this->magentoVersion;
715
    }
716
717
    /**
718
     * Return's the entity type code to be used.
719
     *
720
     * @return string The entity type code to be used
721
     */
722
    public function getEntityTypeCode()
723
    {
724
        return $this->entityTypeCode;
725
    }
726
727
    /**
728
     * Set's the entity type code to be used.
729
     *
730
     * @param string $entityTypeCode The entity type code
731
     *
732
     * @return void
733
     */
734
    public function setEntityTypeCode($entityTypeCode)
735
    {
736
        $this->entityTypeCode = $entityTypeCode;
737
    }
738
739
    /**
740
     * Return's the multiple field delimiter character to use, default value is comma (,).
741
     *
742
     * @return string The multiple field delimiter character
743
     */
744
    public function getMultipleFieldDelimiter()
745
    {
746
        return $this->multipleFieldDelimiter;
747
    }
748
749
    /**
750
     * Return's the multiple value delimiter character to use, default value is comma (|).
751
     *
752
     * @return string The multiple value delimiter character
753
     */
754
    public function getMultipleValueDelimiter()
755
    {
756
        return $this->multipleValueDelimiter;
757
    }
758
759
    /**
760
     * Return's the delimiter character for categories, default value is comma (/).
761
     *
762
     * @return string The delimiter character for categories
763
     */
764
    public function getCategoryDelimiter()
765
    {
766
        return $this->categoryDelimiter;
767
    }
768
769
    /**
770
     * Queries whether or not strict mode is enabled or not, default is TRUE.
771
     *
772
     * @return boolean TRUE if strict mode is enabled, else FALSE
773
     */
774
    public function isStrictMode()
775
    {
776
        return $this->strictMode;
777
    }
778
779
    /**
780
     * Remove's all configured database configuration.
781
     *
782
     * @return void
783
     */
784
    public function clearDatabases()
785
    {
786
        $this->databases->clear();
787
    }
788
789
    /**
790
     * Add's the passed database configuration.
791
     *
792
     * @param \TechDivision\Import\Configuration\DatabaseConfigurationInterface $database The database configuration
793
     *
794
     * @return void
795
     */
796
    public function addDatabase(DatabaseConfigurationInterface $database)
797
    {
798
        $this->databases->add($database);
799
    }
800
801
    /**
802
     * Return's the number database configurations.
803
     *
804
     * @return integer The number of database configurations
805
     */
806
    public function countDatabases()
807
    {
808
        return $this->databases->count();
809
    }
810
811
    /**
812
     * Return's the database configuration with the passed ID.
813
     *
814
     * @param string $id The ID of the database connection to return
815
     *
816
     * @return \TechDivision\Import\Configuration\DatabaseConfigurationInterface The database configuration
817
     * @throws \Exception Is thrown, if no database configuration is available
818
     */
819
    public function getDatabaseById($id)
820
    {
821
822
        // iterate over the configured databases and return the one with the passed ID
823
        /** @var \TechDivision\Import\Configuration\DatabaseConfigurationInterface $database */
824
        foreach ($this->databases as $database) {
825
            if ($database->getId() === $id && $this->isValidDatabaseType($database)) {
826
                return $database;
827
            }
828
        }
829
830
        // throw an exception, if the database with the passed ID is NOT configured
831
        throw new \Exception(sprintf('Database with ID %s can not be found or has an invalid type', $id));
832
    }
833
834
    /**
835
     * Return's the databases for the given type.
836
     *
837
     * @param string $type The database type to return the configurations for
838
     *
839
     * @return \Doctrine\Common\Collections\Collection The collection with the database configurations
840
     */
841
    public function getDatabasesByType($type)
842
    {
843
844
        // initialize the collection for the database configurations
845
        $databases = new ArrayCollection();
846
847
        // iterate over the configured databases and return the one with the passed ID
848
        /** @var \TechDivision\Import\Configuration\DatabaseConfigurationInterface  $database */
849
        foreach ($this->databases as $database) {
850
            if ($database->getType() === $type && $this->isValidDatabaseType($database)) {
851
                $databases->add($database);
852
            }
853
        }
854
855
        // return the database configurations
856
        return $databases;
857
    }
858
859
    /**
860
     * Query's whether or not the passed database configuration has a valid type.
861
     *
862
     * @param \TechDivision\Import\Configuration\DatabaseConfigurationInterface $database The database configuration
863
     *
864
     * @return boolean TRUE if the passed database configuration has a valid type, else FALSE
865
     */
866
    protected function isValidDatabaseType(DatabaseConfigurationInterface $database)
867
    {
868
        return in_array(strtolower($database->getType()), $this->availableDatabaseTypes);
869
    }
870
871
    /**
872
     * Return's the database configuration.
873
     *
874
     * If an explicit DB ID is specified, the method tries to return the database with this ID. If
875
     * the database configuration is NOT available, an execption is thrown.
876
     *
877
     * If no explicit DB ID is specified, the method tries to return the default database configuration,
878
     * if not available the first one.
879
     *
880
     * @return \TechDivision\Import\Configuration\DatabaseConfigurationInterface The database configuration
881
     * @throws \Exception Is thrown, if no database configuration is available
882
     */
883
    public function getDatabase()
884
    {
885
886
        // if a DB ID has been set, try to load the database
887
        if ($useDbId = $this->getUseDbId()) {
888
            return $this->getDatabaseById($useDbId);
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->getDatabaseById($useDbId); (TechDivision\Import\Conf...eConfigurationInterface) is incompatible with the return type declared by the interface TechDivision\Import\Dbal...nInterface::getDatabase of type TechDivision\Import\Dbal...eConfigurationInterface.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
889
        }
890
891
        // iterate over the configured databases and try return the default database
892
        /** @var \TechDivision\Import\Configuration\DatabaseConfigurationInterface  $database */
893
        foreach ($this->databases as $database) {
894
            if ($database->isDefault() && $this->isValidDatabaseType($database)) {
895
                return $database;
896
            }
897
        }
898
899
        // try to return the first database configurtion
900
        if ($this->databases->count() > 0) {
901
            return $this->databases->first();
902
        }
903
904
        // throw an exception, if no database configuration is available
905
        throw new \Exception('There is no database configuration available');
906
    }
907
908
    /**
909
     * Return's the array with the configured operations.
910
     *
911
     * @return array The array with the operations
912
     */
913
    public function getOperations()
914
    {
915
        return $this->operations;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->operations; (array) is incompatible with the return type declared by the interface TechDivision\Import\Conf...nterface::getOperations of type Doctrine\Common\Collections\ArrayCollection.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
916
    }
917
918
    /**
919
     * Return's the ArrayCollection with the configured shortcuts.
920
     *
921
     * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the shortcuts
922
     */
923
    public function getShortcuts()
924
    {
925
        return $this->shortcuts;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->shortcuts; (array) is incompatible with the return type declared by the interface TechDivision\Import\Conf...Interface::getShortcuts of type Doctrine\Common\Collections\ArrayCollection.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
926
    }
927
928
    /**
929
     * Return's the ArrayCollection with the configured loggers.
930
     *
931
     * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the loggers
932
     */
933
    public function getLoggers()
934
    {
935
        return $this->loggers;
936
    }
937
938
    /**
939
     * Set's the flag that import artefacts have to be archived or not.
940
     *
941
     * @param mixed $archiveArtefacts TRUE if artefacts have to be archived, else FALSE
942
     *
943
     * @return void
944
     */
945
    public function setArchiveArtefacts($archiveArtefacts)
946
    {
947
        $this->archiveArtefacts = $this->mapBoolean($archiveArtefacts);
948
    }
949
950
    /**
951
     * Return's the TRUE if the import artefacts have to be archived.
952
     *
953
     * @return boolean TRUE if the import artefacts have to be archived
954
     */
955
    public function haveArchiveArtefacts()
956
    {
957
        return $this->archiveArtefacts;
958
    }
959
960
    /**
961
     * Set's the flag that import artefacts have to be cleared or not.
962
     *
963
     * @param mixed $clearArtefacts TRUE if artefacts have to be cleared, else FALSE
964
     *
965
     * @return void
966
     */
967
    public function setClearArtefacts($clearArtefacts)
968
    {
969
        $this->clearArtefacts = $this->mapBoolean($clearArtefacts);
970
    }
971
972
    /**
973
     * Return's the TRUE if the import artefacts have to be cleared after the import process.
974
     *
975
     * @return boolean TRUE if the import artefacts have to be cleared
976
     */
977
    public function haveClearArtefacts()
978
    {
979
        return $this->clearArtefacts;
980
    }
981
982
    /**
983
     * The directory where the archives will be stored.
984
     *
985
     * @param string $archiveDir The archive directory
986
     *
987
     * @return void
988
     */
989
    public function setArchiveDir($archiveDir)
990
    {
991
        $this->archiveDir = $archiveDir;
992
    }
993
994
    /**
995
     * The directory where the archives will be stored.
996
     *
997
     * @return string The archive directory
998
     */
999
    public function getArchiveDir()
1000
    {
1001
        return $this->archiveDir;
1002
    }
1003
1004
    /**
1005
     * Set's the debug mode.
1006
     *
1007
     * @param mixed $debugMode TRUE if debug mode is enabled, else FALSE
1008
     *
1009
     * @return void
1010
     */
1011
    public function setDebugMode($debugMode)
1012
    {
1013
        $this->debugMode = $this->mapBoolean($debugMode);
1014
    }
1015
1016
    /**
1017
     * Queries whether or not debug mode is enabled or not, default is TRUE.
1018
     *
1019
     * @return boolean TRUE if debug mode is enabled, else FALSE
1020
     */
1021
    public function isDebugMode()
1022
    {
1023
        return $this->debugMode;
1024
    }
1025
1026
    /**
1027
     * Set's the log level to use.
1028
     *
1029
     * @param string $logLevel The log level to use
1030
     *
1031
     * @return void
1032
     */
1033
    public function setLogLevel($logLevel)
1034
    {
1035
        $this->logLevel = $logLevel;
1036
    }
1037
1038
    /**
1039
     * Return's the log level to use.
1040
     *
1041
     * @return string The log level to use
1042
     */
1043
    public function getLogLevel()
1044
    {
1045
        return $this->logLevel;
1046
    }
1047
1048
    /**
1049
     * Set's the explicit DB ID to use.
1050
     *
1051
     * @param string $useDbId The explicit DB ID to use
1052
     *
1053
     * @return void
1054
     */
1055
    public function setUseDbId($useDbId)
1056
    {
1057
        $this->useDbId = $useDbId;
1058
    }
1059
1060
    /**
1061
     * Return's the explicit DB ID to use.
1062
     *
1063
     * @return string The explicit DB ID to use
1064
     */
1065
    public function getUseDbId()
1066
    {
1067
        return $this->useDbId;
1068
    }
1069
1070
    /**
1071
     * Set's the PID filename to use.
1072
     *
1073
     * @param string $pidFilename The PID filename to use
1074
     *
1075
     * @return void
1076
     */
1077
    public function setPidFilename($pidFilename)
1078
    {
1079
        $this->pidFilename = $pidFilename;
1080
    }
1081
1082
    /**
1083
     * Return's the PID filename to use.
1084
     *
1085
     * @return string The PID filename to use
1086
     */
1087
    public function getPidFilename()
1088
    {
1089
        return $this->pidFilename;
1090
    }
1091
1092
    /**
1093
     * Set's the systemm name to be used.
1094
     *
1095
     * @param string $systemName The system name to be used
1096
     *
1097
     * @return void
1098
     */
1099
    public function setSystemName($systemName)
1100
    {
1101
        $this->systemName = $systemName;
1102
    }
1103
1104
    /**
1105
     * Return's the systemm name to be used.
1106
     *
1107
     * @return string The system name to be used
1108
     */
1109
    public function getSystemName()
1110
    {
1111
        return $this->systemName;
1112
    }
1113
1114
    /**
1115
     * Set's the collection with the path of the Magento Edition specific extension libraries.
1116
     *
1117
     * @param array $extensionLibraries The paths of the Magento Edition specific extension libraries
1118
     *
1119
     * @return void
1120
     */
1121
    public function setExtensionLibraries(array $extensionLibraries)
1122
    {
1123
        $this->extensionLibraries = $extensionLibraries;
1124
    }
1125
1126
    /**
1127
     * Return's an array with the path of the Magento Edition specific extension libraries.
1128
     *
1129
     * @return array The paths of the Magento Edition specific extension libraries
1130
     */
1131
    public function getExtensionLibraries()
1132
    {
1133
        return $this->extensionLibraries;
1134
    }
1135
1136
    /**
1137
     * Return's a collection with the path to additional vendor directories.
1138
     *
1139
     * @return \Doctrine\Common\Collections\ArrayCollection The paths to additional vendor directories
1140
     */
1141
    public function getAdditionalVendorDirs()
1142
    {
1143
        return $this->additionalVendorDirs;
1144
    }
1145
1146
    /**
1147
     * The array with the subject's custom header mappings.
1148
     *
1149
     * @return array The custom header mappings
1150
     */
1151
    public function getHeaderMappings()
1152
    {
1153
        return $this->headerMappings;
1154
    }
1155
1156
    /**
1157
     * The array with the subject's custom image types.
1158
     *
1159
     * @return array The custom image types
1160
     */
1161
    public function getImageTypes()
1162
    {
1163
        return $this->imageTypes;
1164
    }
1165
1166
    /**
1167
     * Set's the flag that decides whether or not the import should be wrapped within a single transaction.
1168
     *
1169
     * @param mixed $singleTransaction TRUE if the import should be wrapped in a single transation, else FALSE
1170
     *
1171
     * @return void
1172
     */
1173
    public function setSingleTransaction($singleTransaction)
1174
    {
1175
        $this->singleTransaction = $this->mapBoolean($singleTransaction);
1176
    }
1177
1178
    /**
1179
     * Whether or not the import should be wrapped within a single transation.
1180
     *
1181
     * @return boolean TRUE if the import should be wrapped in a single transation, else FALSE
1182
     */
1183
    public function isSingleTransaction()
1184
    {
1185
        return $this->singleTransaction;
1186
    }
1187
1188
    /**
1189
     * Set's the flag that decides whether or not the the cache has been enabled.
1190
     *
1191
     * @param mixed $cacheEnabled TRUE if the cache has been enabled, else FALSE
1192
     *
1193
     * @return void
1194
     */
1195
    public function setCacheEnabled($cacheEnabled)
1196
    {
1197
        $this->cacheEnabled = $this->mapBoolean($cacheEnabled);
1198
    }
1199
1200
    /**
1201
     * Whether or not the cache functionality should be enabled.
1202
     *
1203
     * @return boolean TRUE if the cache has to be enabled, else FALSE
1204
     */
1205
    public function isCacheEnabled()
1206
    {
1207
        return $this->cacheEnabled;
1208
    }
1209
1210
    /**
1211
     * Set's the passed serial from the commandline to the configuration.
1212
     *
1213
     * @param string $serial The serial from the commandline
1214
     *
1215
     * @return void
1216
     */
1217
    public function setSerial($serial)
1218
    {
1219
        $this->serial = $serial;
1220
    }
1221
1222
    /**
1223
     * Return's the serial from the commandline.
1224
     *
1225
     * @return string The serial
1226
     */
1227
    public function getSerial()
1228
    {
1229
        return $this->serial;
1230
    }
1231
1232
    /**
1233
     * Return's the configuration for the caches.
1234
     *
1235
     * @return \Doctrine\Common\Collections\ArrayCollection The cache configurations
1236
     */
1237
    public function getCaches()
1238
    {
1239
1240
        // iterate over the caches and set the parent configuration instance
1241
        foreach ($this->caches as $cache) {
1242
            $cache->setConfiguration($this);
1243
        }
1244
1245
        // return the array with the caches
1246
        return $this->caches;
1247
    }
1248
1249
    /**
1250
     * Return's the cache configuration for the passed type.
1251
     *
1252
     * @param string $type The cache type to return the configuation for
1253
     *
1254
     * @return \TechDivision\Import\Configuration\CacheConfigurationInterface The cache configuration
1255
     */
1256
    public function getCacheByType($type)
1257
    {
1258
1259
        // load the available cache configurations
1260
        $caches = $this->getCaches();
1261
1262
        // try to load the cache for the passed type
1263
        /** @var \TechDivision\Import\Configuration\CacheConfigurationInterface $cache */
1264
        foreach ($caches as $cache) {
1265
            if ($cache->getType() === $type) {
1266
                return $cache;
1267
            }
1268
        }
1269
    }
1270
1271
    /**
1272
     * Return's the alias configuration.
1273
     *
1274
     * @return \Doctrine\Common\Collections\ArrayCollection The alias configuration
1275
     */
1276
    public function getAliases()
1277
    {
1278
        return $this->aliases;
1279
    }
1280
1281
    /**
1282
     * Set's the prefix for the move files subject.
1283
     *
1284
     * @param string $moveFilesPrefix The prefix for the move files subject
1285
     *
1286
     * @return void
1287
     */
1288
    public function setMoveFilesPrefix($moveFilesPrefix)
1289
    {
1290
        $this->moveFilesPrefix = $moveFilesPrefix;
1291
    }
1292
1293
    /**
1294
     * Return's the prefix for the move files subject.
1295
     *
1296
     * @return string The prefix for the move files subject
1297
     */
1298
    public function getMoveFilesPrefix()
1299
    {
1300
        return $this->moveFilesPrefix;
1301
    }
1302
1303
    /**
1304
     * Set's the shortcut that maps the operation names that has to be executed.
1305
     *
1306
     * @param string $shortcut The shortcut
1307
     *
1308
     * @return void
1309
     */
1310
    public function setShortcut($shortcut)
1311
    {
1312
        $this->shortcut = $shortcut;
1313
    }
1314
1315
    /**
1316
     * Return's the shortcut that maps the operation names that has to be executed.
1317
     *
1318
     * @return string The shortcut
1319
     */
1320
    public function getShortcut()
1321
    {
1322
        return $this->shortcut;
1323
    }
1324
1325
    /**
1326
     * Set's the name of the command that has been invoked.
1327
     *
1328
     * @param string $commandName The command name
1329
     *
1330
     * @return void
1331
     */
1332
    public function setCommandName($commandName)
1333
    {
1334
        $this->commandName = $commandName;
1335
    }
1336
1337
    /**
1338
     * Return's the name of the command that has been invoked.
1339
     *
1340
     * @return string The command name
1341
     */
1342
    public function getCommandName()
1343
    {
1344
        return $this->commandName;
1345
    }
1346
1347
    /**
1348
     * Set's the username to save the import history with.
1349
     *
1350
     * @param string $username The username
1351
     *
1352
     * @return void
1353
     */
1354
    public function setUsername($username)
1355
    {
1356
        $this->username = $username;
1357
    }
1358
1359
    /**
1360
     * Return's the username to save the import history with.
1361
     *
1362
     * @return string The username
1363
     */
1364
    public function getUsername()
1365
    {
1366
        return $this->username;
1367
    }
1368
1369
    /**
1370
     * Set's the array with the finder mappings.
1371
     *
1372
     * @param array $finderMappings The finder mappings
1373
     *
1374
     * @return void
1375
     */
1376
    public function setFinderMappings(array $finderMappings)
1377
    {
1378
1379
        // convert the finder mappings keys, which are constants, to their values
1380
        foreach ($finderMappings as $entityTypeCode => $mappings) {
1381
            foreach ($mappings as $key => $value) {
1382
                $this->finderMappings[$entityTypeCode][defined($key) ? constant($key) : $key] = $value;
1383
            }
1384
        }
1385
    }
1386
1387
    /**
1388
     * Return's the array with the finder mappings.
1389
     *
1390
     * @return array The finder mappings
1391
     */
1392
    public function getFinderMappings()
1393
    {
1394
        return $this->finderMappings;
1395
    }
1396
1397
    /**
1398
     * Return's the mapped finder for the passed key.
1399
     *
1400
     * @param string $key The key of the finder to map
1401
     *
1402
     * @return string The mapped finder name
1403
     * @throws \InvalidArgumentException Is thrown if the mapping with passed key can not be resolved
1404
     */
1405
    public function getFinderMappingByKey($key)
1406
    {
1407
1408
        // flatten the array, because we don't handle the entity type code yet
1409
        $finderMappings = array_reduce($this->finderMappings, function ($carry, $item) {
1410
            return array_replace($carry, $item);
1411
        }, array());
1412
1413
        // try to resolve the mapping for the finder with the passed key
1414
        if (isset($finderMappings[$key])) {
1415
            return $finderMappings[$key];
1416
        }
1417
1418
        // throw an exception otherwise
1419
        throw new \InvalidArgumentException(
1420
            sprintf('Can\'t load mapping for finder with key "%s"', $key)
1421
        );
1422
    }
1423
1424
    /**
1425
     * Sets the default values from the configuration.
1426
     *
1427
     * @param array $defaultValues The array with the default values
1428
     *
1429
     * @return void
1430
     */
1431
    public function setDefaultValues(array $defaultValues)
1432
    {
1433
        $this->defaultValues = $defaultValues;
1434
    }
1435
1436
    /**
1437
     * Load the default values from the configuration.
1438
     *
1439
     * @return array The array with the default values
1440
     */
1441
    public function getDefaultValues()
1442
    {
1443
        return $this->defaultValues;
1444
    }
1445
1446
    /**
1447
     * Return's an unique array with the prefixes of all configured subjects.
1448
     *
1449
     * @param array $ignore An array with prefixes that has to be ignored
1450
     *
1451
     * @return array An array with the available prefixes
1452
     */
1453
    public function getPrefixes($ignore = array('.*'))
1454
    {
1455
1456
        // initialize the array for the prefixes
1457
        $prefixes = array();
1458
1459
        foreach ($this->getOperations() as $operation) {
1460
            foreach ($operation as $entityTypes) {
1461
                foreach ($entityTypes as $operationConfiguration) {
1462
                    foreach ($operationConfiguration->getPlugins() as $plugin) {
1463
                        foreach ($plugin->getSubjects() as $subject) {
1464
                            // ignore the prefix, if it has already been added or it has to be ignored
1465
                            if (in_array($prefix = $subject->getPrefix(), $prefixes, true) ||
1466
                                in_array($prefix, $ignore, true)
1467
                            ) {
1468
                                continue;
1469
                            }
1470
1471
                            // add the prefix to the list
1472
                            $prefixes[] = $prefix;
1473
                        }
1474
                    }
1475
                }
1476
            }
1477
        }
1478
1479
        // return the array with the unique prefixes
1480
        return $prefixes;
1481
    }
1482
1483
    /**
1484
     * Return's an array with the subjects which prefix is NOT in the passed
1485
     * array of blacklisted prefixes and that matches the filters.
1486
     *
1487
     * @param callable[] $filters An array with filters to filter the subjects that has to be returned
1488
     *
1489
     * @return array An array with the matching subjects
1490
     */
1491
    public function getSubjects(array $filters = array())
1492
    {
1493
1494
        // initialize the array for the prefixes
1495
        $subjects = array();
1496
1497
        // iterate over all configured subjects
1498
        foreach ($this->getOperations() as $operation) {
1499
            foreach ($operation as $entityTypes) {
1500
                foreach ($entityTypes as $operationConfiguration) {
1501
                    foreach ($operationConfiguration->getPlugins() as $plugin) {
1502
                        /** @var \TechDivision\Import\Configuration\SubjectConfigurationInterface $subject */
1503
                        foreach ($plugin->getSubjects() as $subject) {
1504
                            $subjects[] = $subject;
1505
                        }
1506
                    }
1507
                }
1508
            }
1509
        }
1510
1511
        // filter the subjects
1512
        foreach ($filters as $filter) {
1513
            $subjects = array_filter($subjects, $filter);
1514
        }
1515
1516
        // return the array with the filtered subjects
1517
        return $subjects;
1518
    }
1519
1520
    /**
1521
     * Get the definition from an empty value
1522
     *
1523
     * @return string A string with constant for empty attribute value
1524
     * @throws \InvalidArgumentException Is thrown if default value ist overwritten with empty value
1525
     */
1526
    public function getEmptyAttributeValueConstant()
1527
    {
1528
        if ($this->emptyAttributeValueConstant !== null && $this->emptyAttributeValueConstant !== '') {
1529
            return $this->emptyAttributeValueConstant;
1530
        }
1531
1532
        // throw an exception otherwise
1533
        throw new \InvalidArgumentException(
1534
            'Can\'t use empty value as definition for "empty-attribute-value-constant"'
1535
        );
1536
    }
1537
1538
    /**
1539
     * Set the definition from an empty value
1540
     *
1541
     * @param string $emptyAttributeValueConstant give the definition for an emppty value
1542
     *
1543
     * @return void
1544
     */
1545
    public function setEmptyAttributeValueConstant($emptyAttributeValueConstant)
1546
    {
1547
        $this->emptyAttributeValueConstant = $emptyAttributeValueConstant;
1548
    }
1549
}
1550