Completed
Pull Request — master (#206)
by Tim
12:38 queued 12:38
created

ImportProcessor::setUrlRewriteRepository()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * TechDivision\Import\Services\ImportProcessor
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
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Services;
22
23
use TechDivision\Import\Utils\MemberNames;
24
use TechDivision\Import\Utils\RegistryKeys;
25
use TechDivision\Import\Actions\ActionInterface;
26
use TechDivision\Import\Connection\ConnectionInterface;
27
use TechDivision\Import\Assembler\CategoryAssemblerInterface;
28
use TechDivision\Import\Repositories\StoreRepositoryInterface;
29
use TechDivision\Import\Repositories\CategoryRepositoryInterface;
30
use TechDivision\Import\Repositories\TaxClassRepositoryInterface;
31
use TechDivision\Import\Repositories\LinkTypeRepositoryInterface;
32
use TechDivision\Import\Repositories\AdminUserRepositoryInterface;
33
use TechDivision\Import\Repositories\ImageTypeRepositoryInterface;
34
use TechDivision\Import\Repositories\UrlRewriteRepositoryInterface;
35
use TechDivision\Import\Repositories\EavAttributeRepositoryInterface;
36
use TechDivision\Import\Repositories\StoreWebsiteRepositoryInterface;
37
use TechDivision\Import\Repositories\CustomerGroupRepositoryInterface;
38
use TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface;
39
use TechDivision\Import\Repositories\LinkAttributeRepositoryInterface;
40
use TechDivision\Import\Repositories\CoreConfigDataRepositoryInterface;
41
use TechDivision\Import\Repositories\CategoryVarcharRepositoryInterface;
42
use TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface;
43
use TechDivision\Import\Repositories\EavAttributeGroupRepositoryInterface;
44
use TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface;
45
46
/**
47
 * Processor implementation to load global data.
48
 *
49
 * @author    Tim Wagner <[email protected]>
50
 * @copyright 2016 TechDivision GmbH <[email protected]>
51
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
52
 * @link      https://github.com/techdivision/import
53
 * @link      http://www.techdivision.com
54
 */
55
class ImportProcessor implements ImportProcessorInterface
56
{
57
58
    /**
59
     * A connection to use.
60
     *
61
     * @var \TechDivision\Import\Connection\ConnectionInterface
62
     */
63
    protected $connection;
64
65
    /**
66
     * The category assembler instance.
67
     *
68
     * @var \TechDivision\Import\Assembler\CategoryAssemblerInterface
69
     */
70
    protected $categoryAssembler;
71
72
    /**
73
     * The repository to access categories.
74
     *
75
     * @var \TechDivision\Import\Repositories\CategoryRepository
76
     */
77
    protected $categoryRepository;
78
79
    /**
80
     * The repository to access category varchar values.
81
     *
82
     * @var \TechDivision\Import\Repositories\CategoryVarcharRepositoryInterface
83
     */
84
    protected $categoryVarcharRepository;
85
86
    /**
87
     * The repository to access EAV attributes.
88
     *
89
     * @var \TechDivision\Import\Repositories\EavAttributeRepositoryInterface
90
     */
91
    protected $eavAttributeRepository;
92
93
    /**
94
     * The repository to access EAV attribute sets.
95
     *
96
     * @var \TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface
97
     */
98
    protected $eavAttributeSetRepository;
99
100
    /**
101
     * The repository to access EAV attribute groups.
102
     *
103
     * @var \TechDivision\Import\Repositories\EavAttributeGroupRepositoryInterface
104
     */
105
    protected $eavAttributeGroupRepository;
106
107
    /**
108
     * The repository to access EAV attribute groups.
109
     *
110
     * @var \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface
111
     */
112
    protected $eavAttributeOptionValueRepository;
113
114
    /**
115
     * The repository to access EAV entity types.
116
     *
117
     * @var \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface
118
     */
119
    protected $eavEntityTypeRepository;
120
121
    /**
122
     * The repository to access stores.
123
     *
124
     * @var \TechDivision\Import\Repositories\StoreRepositoryInterface
125
     */
126
    protected $storeRepository;
127
128
    /**
129
     * The repository to access store websites.
130
     *
131
     * @var \TechDivision\Import\Repositories\StoreWebsiteRepositoryInterface
132
     */
133
    protected $storeWebsiteRepository;
134
135
    /**
136
     * The repository to access tax classes.
137
     *
138
     * @var \TechDivision\Import\Repositories\TaxClassRepositoryInterface
139
     */
140
    protected $taxClassRepository;
141
142
    /**
143
     * The repository to access link types.
144
     *
145
     * @var \TechDivision\Import\Repositories\LinkTypeRepositoryInterface
146
     */
147
    protected $linkTypeRepository;
148
149
    /**
150
     * The repository to access image types.
151
     *
152
     * @var \TechDivision\Import\Repositories\ImageTypeRepositoryInterface
153
     */
154
    protected $imageTypeRepository;
155
156
    /**
157
     * The repository to access link attributes.
158
     *
159
     * @var \TechDivision\Import\Repositories\LinkAttributeRepositoryInterface
160
     */
161
    protected $linkAttributeRepository;
162
163
    /**
164
     * The repository to access the configuration.
165
     *
166
     * @var \TechDivision\Import\Repositories\CoreConfigDataRepositoryInterface
167
     */
168
    protected $coreConfigDataRepository;
169
170
    /**
171
     * The repository to access the customer groups.
172
     *
173
     * @var \TechDivision\Import\Repositories\CustomerGroupRepositoryInterface
174
     */
175
    protected $customerGroupRepository;
176
177
    /**
178
     * The repository to access the admin user.
179
     *
180
     * @var \TechDivision\Import\Repositories\AdminUserRepositoryInterface
181
     */
182
    protected $adminUserRepository;
183
184
    /**
185
     * The repository to access the URL rewrites.
186
     *
187
     * @var \TechDivision\Import\Repositories\UrlRewriteRepositoryInterface
188
     */
189
    protected $urlRewriteRepository;
190
191
    /**
192
     * The action for store CRUD methods.
193
     *
194
     * @var \TechDivision\Import\Actions\ActionInterface
195
     */
196
    protected $storeAction;
197
198
    /**
199
     * The action for store group CRUD methods.
200
     *
201
     * @var \TechDivision\Import\Actions\ActionInterface
202
     */
203
    protected $storeGroupAction;
204
205
    /**
206
     * The action for store website CRUD methods.
207
     *
208
     * @var \TechDivision\Import\Actions\ActionInterface
209
     */
210
    protected $storeWebsiteAction;
211
212
    /**
213
     * The action for import history CRUD methods.
214
     *
215
     * @var \TechDivision\Import\Actions\ActionInterface
216
     */
217
    protected $importHistoryAction;
218
219
    /**
220
     * Initialize the processor with the necessary assembler and repository instances.
221
     *
222
     * @param \TechDivision\Import\Connection\ConnectionInterface                          $connection                        The connection to use
223
     * @param \TechDivision\Import\Assembler\CategoryAssemblerInterface                    $categoryAssembler                 The category assembler instance
224
     * @param \TechDivision\Import\Repositories\CategoryRepositoryInterface                $categoryRepository                The repository to access categories
225
     * @param \TechDivision\Import\Repositories\CategoryVarcharRepositoryInterface         $categoryVarcharRepository         The repository to access category varchar values
226
     * @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface            $eavAttributeRepository            The repository to access EAV attributes
227
     * @param \TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface         $eavAttributeSetRepository         The repository to access EAV attribute sets
228
     * @param \TechDivision\Import\Repositories\EavAttributeGroupRepositoryInterface       $eavAttributeGroupRepository       The repository to access EAV attribute groups
229
     * @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository The repository to access EAV attribute option value repository
230
     * @param \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface           $eavEntityTypeRepository           The repository to access EAV entity types
231
     * @param \TechDivision\Import\Repositories\StoreRepositoryInterface                   $storeRepository                   The repository to access stores
232
     * @param \TechDivision\Import\Repositories\StoreWebsiteRepositoryInterface            $storeWebsiteRepository            The repository to access store websites
233
     * @param \TechDivision\Import\Repositories\TaxClassRepositoryInterface                $taxClassRepository                The repository to access tax classes
234
     * @param \TechDivision\Import\Repositories\LinkTypeRepositoryInterface                $linkTypeRepository                The repository to access link types
235
     * @param \TechDivision\Import\Repositories\LinkAttributeRepositoryInterface           $linkAttributeRepository           The repository to access link attributes
236
     * @param \TechDivision\Import\Repositories\CoreConfigDataRepositoryInterface          $coreConfigDataRepository          The repository to access the configuration
237
     * @param \TechDivision\Import\Repositories\CustomerGroupRepositoryInterface           $customerGroupRepository           The repository to access the customer groups
238
     * @param \TechDivision\Import\Repositories\ImageTypeRepositoryInterface               $imageTypeRepository               The repository to access images types
239
     * @param \TechDivision\Import\Repositories\AdminUserRepositoryInterface               $adminUserRepository               The repository to access admin users
240
     * @param \TechDivision\Import\Repositories\UrlRewriteRepositoryInterface              $urlRewriteRepository              The repository to access URL rewrites
241
     * @param \TechDivision\Import\Actions\ActionInterface                                 $storeAction                       The action with the store CRUD methods
242
     * @param \TechDivision\Import\Actions\ActionInterface                                 $storeGroupAction                  The action with the store group CRUD methods
243
     * @param \TechDivision\Import\Actions\ActionInterface                                 $storeWebsiteAction                The action with the store website CRUD methods
244
     * @param \TechDivision\Import\Actions\ActionInterface                                 $importHistoryAction               The action with the import history CRUD methods
245
     */
246
    public function __construct(
247
        ConnectionInterface $connection,
248
        CategoryAssemblerInterface $categoryAssembler,
249
        CategoryRepositoryInterface $categoryRepository,
250
        CategoryVarcharRepositoryInterface $categoryVarcharRepository,
251
        EavAttributeRepositoryInterface $eavAttributeRepository,
252
        EavAttributeSetRepositoryInterface $eavAttributeSetRepository,
253
        EavAttributeGroupRepositoryInterface $eavAttributeGroupRepository,
254
        EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository,
255
        EavEntityTypeRepositoryInterface $eavEntityTypeRepository,
256
        StoreRepositoryInterface $storeRepository,
257
        StoreWebsiteRepositoryInterface $storeWebsiteRepository,
258
        TaxClassRepositoryInterface $taxClassRepository,
259
        LinkTypeRepositoryInterface $linkTypeRepository,
260
        LinkAttributeRepositoryInterface $linkAttributeRepository,
261
        CoreConfigDataRepositoryInterface $coreConfigDataRepository,
262
        CustomerGroupRepositoryInterface $customerGroupRepository,
263
        ImageTypeRepositoryInterface $imageTypeRepository,
264
        AdminUserRepositoryInterface $adminUserRepository,
265
        UrlRewriteRepositoryInterface $urlRewriteRepository,
266
        ActionInterface $storeAction,
267
        ActionInterface $storeGroupAction,
268
        ActionInterface $storeWebsiteAction,
269
        ActionInterface $importHistoryAction
270
    ) {
271
        $this->setConnection($connection);
272
        $this->setCategoryAssembler($categoryAssembler);
273
        $this->setCategoryRepository($categoryRepository);
274
        $this->setCategoryVarcharRepository($categoryVarcharRepository);
275
        $this->setEavAttributeRepository($eavAttributeRepository);
276
        $this->setEavAttributeSetRepository($eavAttributeSetRepository);
277
        $this->setEavAttributeGroupRepository($eavAttributeGroupRepository);
278
        $this->setEavAttributeOptionValueRepository($eavAttributeOptionValueRepository);
279
        $this->setEavEntityTypeRepository($eavEntityTypeRepository);
280
        $this->setStoreRepository($storeRepository);
281
        $this->setStoreWebsiteRepository($storeWebsiteRepository);
282
        $this->setTaxClassRepository($taxClassRepository);
283
        $this->setLinkTypeRepository($linkTypeRepository);
284
        $this->setLinkAttributeRepository($linkAttributeRepository);
285
        $this->setCoreConfigDataRepository($coreConfigDataRepository);
286
        $this->setImageTypeRepository($imageTypeRepository);
287
        $this->setCustomerGroupRepository($customerGroupRepository);
288
        $this->setAdminUserRepository($adminUserRepository);
289
        $this->setUrlRewriteRepository($urlRewriteRepository);
290
        $this->setStoreAction($storeAction);
291
        $this->setStoreGroupAction($storeGroupAction);
292
        $this->setStoreWebsiteAction($storeWebsiteAction);
293
        $this->setImportHistoryAction($importHistoryAction);
294
    }
295
296
    /**
297
     * Set's the passed connection.
298
     *
299
     * @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to set
300
     *
301
     * @return void
302
     */
303
    public function setConnection(ConnectionInterface $connection)
304
    {
305
        $this->connection = $connection;
306
    }
307
308
    /**
309
     * Return's the connection.
310
     *
311
     * @return \TechDivision\Import\Connection\ConnectionInterface The connection instance
312
     */
313
    public function getConnection()
314
    {
315
        return $this->connection;
316
    }
317
318
    /**
319
     * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO
320
     * object instance are not committed until you end the transaction by calling ProductProcessor::commit().
321
     * Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection
322
     * to autocommit mode.
323
     *
324
     * @return boolean Returns TRUE on success or FALSE on failure
325
     * @link http://php.net/manual/en/pdo.begintransaction.php
326
     */
327
    public function beginTransaction()
328
    {
329
        return $this->connection->beginTransaction();
330
    }
331
332
    /**
333
     * Commits a transaction, returning the database connection to autocommit mode until the next call to
334
     * ProductProcessor::beginTransaction() starts a new transaction.
335
     *
336
     * @return boolean Returns TRUE on success or FALSE on failure
337
     * @link http://php.net/manual/en/pdo.commit.php
338
     */
339
    public function commit()
340
    {
341
        return $this->connection->commit();
342
    }
343
344
    /**
345
     * Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction().
346
     *
347
     * If the database was set to autocommit mode, this function will restore autocommit mode after it has
348
     * rolled back the transaction.
349
     *
350
     * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition
351
     * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit
352
     * COMMIT will prevent you from rolling back any other changes within the transaction boundary.
353
     *
354
     * @return boolean Returns TRUE on success or FALSE on failure
355
     * @link http://php.net/manual/en/pdo.rollback.php
356
     */
357
    public function rollBack()
358
    {
359
        return $this->connection->rollBack();
360
    }
361
362
    /**
363
     * Set's the category assembler.
364
     *
365
     * @param \TechDivision\Import\Assembler\CategoryAssemblerInterface $categoryAssembler The category assembler
366
     *
367
     * @return void
368
     */
369
    public function setCategoryAssembler($categoryAssembler)
370
    {
371
        $this->categoryAssembler = $categoryAssembler;
372
    }
373
374
    /**
375
     * Return's the category assembler.
376
     *
377
     * @return \TechDivision\Import\Assembler\CategoryAssemblerInterface The category assembler instance
378
     */
379
    public function getCategoryAssembler()
380
    {
381
        return $this->categoryAssembler;
382
    }
383
384
    /**
385
     * Set's the repository to access categories.
386
     *
387
     * @param \TechDivision\Import\Repositories\CategoryRepositoryInterface $categoryRepository The repository to access categories
388
     *
389
     * @return void
390
     */
391
    public function setCategoryRepository(CategoryRepositoryInterface $categoryRepository)
392
    {
393
        $this->categoryRepository = $categoryRepository;
0 ignored issues
show
Documentation Bug introduced by
$categoryRepository is of type object<TechDivision\Impo...oryRepositoryInterface>, but the property $categoryRepository was declared to be of type object<TechDivision\Impo...ies\CategoryRepository>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
394
    }
395
396
    /**
397
     * Return's the repository to access categories.
398
     *
399
     * @return \TechDivision\Import\Repositories\CategoryRepositoryInterface The repository instance
400
     */
401
    public function getCategoryRepository()
402
    {
403
        return $this->categoryRepository;
404
    }
405
406
    /**
407
     * Return's the repository to access category varchar values.
408
     *
409
     * @param \TechDivision\Import\Repositories\CategoryVarcharRepositoryInterface $categoryVarcharRepository The repository instance
410
     *
411
     * @return void
412
     */
413
    public function setCategoryVarcharRepository(CategoryVarcharRepositoryInterface $categoryVarcharRepository)
414
    {
415
        $this->categoryVarcharRepository = $categoryVarcharRepository;
416
    }
417
418
    /**
419
     * Return's the repository to access category varchar values.
420
     *
421
     * @return \TechDivision\Import\Repositories\CategoryVarcharRepositoryInterface The repository instance
422
     */
423
    public function getCategoryVarcharRepository()
424
    {
425
        return $this->categoryVarcharRepository;
426
    }
427
428
    /**
429
     * Set's the repository to access EAV attributes.
430
     *
431
     * @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface $eavAttributeRepository The repository to access EAV attributes
432
     *
433
     * @return void
434
     */
435
    public function setEavAttributeRepository(EavAttributeRepositoryInterface $eavAttributeRepository)
436
    {
437
        $this->eavAttributeRepository = $eavAttributeRepository;
438
    }
439
440
    /**
441
     * Return's the repository to access EAV attributes.
442
     *
443
     * @return \TechDivision\Import\Repositories\EavAttributeRepositoryInterface The repository instance
444
     */
445
    public function getEavAttributeRepository()
446
    {
447
        return $this->eavAttributeRepository;
448
    }
449
450
    /**
451
     * Set's the repository to access EAV attribute sets.
452
     *
453
     * @param \TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface $eavAttributeSetRepository The repository the access EAV attribute sets
454
     *
455
     * @return void
456
     */
457
    public function setEavAttributeSetRepository(EavAttributeSetRepositoryInterface $eavAttributeSetRepository)
458
    {
459
        $this->eavAttributeSetRepository = $eavAttributeSetRepository;
460
    }
461
462
    /**
463
     * Return's the repository to access EAV attribute sets.
464
     *
465
     * @return \TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface The repository instance
466
     */
467
    public function getEavAttributeSetRepository()
468
    {
469
        return $this->eavAttributeSetRepository;
470
    }
471
472
    /**
473
     * Set's the repository to access EAV attribute groups.
474
     *
475
     * @param \TechDivision\Import\Repositories\EavAttributeGroupRepositoryInterface $eavAttributeGroupRepository The repository the access EAV attribute groups
476
     *
477
     * @return void
478
     */
479
    public function setEavAttributeGroupRepository(EavAttributeGroupRepositoryInterface $eavAttributeGroupRepository)
480
    {
481
        $this->eavAttributeGroupRepository = $eavAttributeGroupRepository;
482
    }
483
484
    /**
485
     * Return's the repository to access EAV attribute groups.
486
     *
487
     * @return \TechDivision\Import\Repositories\EavAttributeGroupRepositoryInterface The repository instance
488
     */
489
    public function getEavAttributeGroupRepository()
490
    {
491
        return $this->eavAttributeGroupRepository;
492
    }
493
494
    /**
495
     * Set's the repository to access EAV attribute option values.
496
     *
497
     * @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository The repository the access EAV attribute option values
498
     *
499
     * @return void
500
     */
501
    public function setEavAttributeOptionValueRepository(EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository)
502
    {
503
        $this->eavAttributeOptionValueRepository = $eavAttributeOptionValueRepository;
504
    }
505
506
    /**
507
     * Return's the repository to access EAV attribute option values.
508
     *
509
     * @return \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface The repository instance
510
     */
511
    public function getEavAttributeOptionValueRepository()
512
    {
513
        return $this->eavAttributeOptionValueRepository;
514
    }
515
516
    /**
517
     * Return's the repository to access EAV entity types.
518
     *
519
     * @return \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface The repository instance
520
     */
521
    public function getEavEntityTypeRepository()
522
    {
523
        return $this->eavEntityTypeRepository;
524
    }
525
526
    /**
527
     * Set's the repository to access EAV entity types.
528
     *
529
     * @param \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface $eavEntityTypeRepository The repository the access EAV entity types
530
     *
531
     * @return void
532
     */
533
    public function setEavEntityTypeRepository(EavEntityTypeRepositoryInterface $eavEntityTypeRepository)
534
    {
535
        $this->eavEntityTypeRepository = $eavEntityTypeRepository;
536
    }
537
538
    /**
539
     * Set's the repository to access stores.
540
     *
541
     * @param \TechDivision\Import\Repositories\StoreRepositoryInterface $storeRepository The repository the access stores
542
     *
543
     * @return void
544
     */
545
    public function setStoreRepository(StoreRepositoryInterface $storeRepository)
546
    {
547
        $this->storeRepository = $storeRepository;
548
    }
549
550
    /**
551
     * Return's the repository to access stores.
552
     *
553
     * @return \TechDivision\Import\Repositories\StoreRepositoryInterface The repository instance
554
     */
555
    public function getStoreRepository()
556
    {
557
        return $this->storeRepository;
558
    }
559
560
    /**
561
     * Set's the repository to access store websites.
562
     *
563
     * @param \TechDivision\Import\Repositories\StoreWebsiteRepositoryInterface $storeWebsiteRepository The repository the access store websites
564
     *
565
     * @return void
566
     */
567
    public function setStoreWebsiteRepository(StoreWebsiteRepositoryInterface $storeWebsiteRepository)
568
    {
569
        $this->storeWebsiteRepository = $storeWebsiteRepository;
570
    }
571
572
    /**
573
     * Return's the repository to access store websites.
574
     *
575
     * @return \TechDivision\Import\Repositories\StoreWebsiteRepositoryInterface The repository instance
576
     */
577
    public function getStoreWebsiteRepository()
578
    {
579
        return $this->storeWebsiteRepository;
580
    }
581
582
    /**
583
     * Set's the repository to access tax classes.
584
     *
585
     * @param \TechDivision\Import\Repositories\TaxClassRepositoryInterface $taxClassRepository The repository the access stores
586
     *
587
     * @return void
588
     */
589
    public function setTaxClassRepository(TaxClassRepositoryInterface $taxClassRepository)
590
    {
591
        $this->taxClassRepository = $taxClassRepository;
592
    }
593
594
    /**
595
     * Return's the repository to access tax classes.
596
     *
597
     * @return \TechDivision\Import\Repositories\TaxClassRepositoryInterface The repository instance
598
     */
599
    public function getTaxClassRepository()
600
    {
601
        return $this->taxClassRepository;
602
    }
603
604
    /**
605
     * Set's the repository to access link types.
606
     *
607
     * @param \TechDivision\Import\Repositories\LinkTypeRepositoryInterface $linkTypeRepository The repository to access link types
608
     *
609
     * @return void
610
     */
611
    public function setLinkTypeRepository(LinkTypeRepositoryInterface $linkTypeRepository)
612
    {
613
        $this->linkTypeRepository = $linkTypeRepository;
614
    }
615
616
    /**
617
     * Return's the repository to access link types.
618
     *
619
     * @return \TechDivision\Import\Repositories\LinkTypeRepositoryInterface The repository instance
620
     */
621
    public function getLinkTypeRepository()
622
    {
623
        return $this->linkTypeRepository;
624
    }
625
626
    /**
627
     * Set's the repository to access link attributes.
628
     *
629
     * @param \TechDivision\Import\Repositories\LinkAttributeRepositoryInterface $linkAttributeRepository The repository to access link attributes
630
     *
631
     * @return void
632
     */
633
    public function setLinkAttributeRepository(LinkAttributeRepositoryInterface $linkAttributeRepository)
634
    {
635
        $this->linkAttributeRepository = $linkAttributeRepository;
636
    }
637
638
    /**
639
     * Return's the repository to access link attributes.
640
     *
641
     * @return \TechDivision\Import\Repositories\LinkAttributeRepositoryInterface The repository instance
642
     */
643
    public function getLinkAttributeRepository()
644
    {
645
        return $this->linkAttributeRepository;
646
    }
647
648
    /**
649
     * Set's the repository to access link types.
650
     *
651
     * @param \TechDivision\Import\Repositories\ImageTypeRepositoryInterface $imageTypeRepository The repository to access image types
652
     *
653
     * @return void
654
     */
655
    public function setImageTypeRepository(ImageTypeRepositoryInterface $imageTypeRepository)
656
    {
657
        $this->imageTypeRepository = $imageTypeRepository;
658
    }
659
660
    /**
661
     * Return's the repository to access link types.
662
     *
663
     * @return \TechDivision\Import\Repositories\ImageTypeRepositoryInterface The repository instance
664
     */
665
    public function getImageTypeRepository()
666
    {
667
        return $this->imageTypeRepository;
668
    }
669
670
    /**
671
     * Set's the repository to access the Magento 2 configuration.
672
     *
673
     * @param \TechDivision\Import\Repositories\CoreConfigDataRepositoryInterface $coreConfigDataRepository The repository to access the Magento 2 configuration
674
     *
675
     * @return void
676
     */
677
    public function setCoreConfigDataRepository(CoreConfigDataRepositoryInterface $coreConfigDataRepository)
678
    {
679
        $this->coreConfigDataRepository = $coreConfigDataRepository;
680
    }
681
682
    /**
683
     * Return's the repository to access the Magento 2 configuration.
684
     *
685
     * @return \TechDivision\Import\Repositories\CoreConfigDataRepositoryInterface The repository instance
686
     */
687
    public function getCoreConfigDataRepository()
688
    {
689
        return $this->coreConfigDataRepository;
690
    }
691
692
    /**
693
     * Set's the repository to access the customer groups.
694
     *
695
     * @param \TechDivision\Import\Repositories\CustomerGroupRepositoryInterface $customerGroupRepository The repository to access the customer groups
696
     *
697
     * @return void
698
     */
699
    public function setCustomerGroupRepository(CustomerGroupRepositoryInterface $customerGroupRepository)
700
    {
701
        $this->customerGroupRepository = $customerGroupRepository;
702
    }
703
704
    /**
705
     * Return's the repository to access the customer groups.
706
     *
707
     * @return \TechDivision\Import\Repositories\CustomerGroupRepositoryInterface The repository instance
708
     */
709
    public function getCustomerGroupRepository()
710
    {
711
        return $this->customerGroupRepository;
712
    }
713
714
    /**
715
     * Set's the repository to access the admin users.
716
     *
717
     * @param \TechDivision\Import\Repositories\AdminUserRepositoryInterface $adminUserRepository The repository to access the admin users
718
     *
719
     * @return void
720
     */
721
    public function setAdminUserRepository(AdminUserRepositoryInterface $adminUserRepository)
722
    {
723
        $this->adminUserRepository = $adminUserRepository;
724
    }
725
726
    /**
727
     * Return's the repository to access the admin users.
728
     *
729
     * @return \TechDivision\Import\Repositories\AdminUserRepositoryInterface The repository instance
730
     */
731
    public function getAdminUserRepository()
732
    {
733
        return $this->adminUserRepository;
734
    }
735
736
    /**
737
     * Set's the repository to access the URL rewrites.
738
     *
739
     * @param \TechDivision\Import\Repositories\UrlRewriteRepositoryInterface $urlRewriteRepository The repository to access the URL rewrites
740
     *
741
     * @return void
742
     */
743
    public function setUrlRewriteRepository(UrlRewriteRepositoryInterface $urlRewriteRepository)
744
    {
745
        $this->urlRewriteRepository = $urlRewriteRepository;
746
    }
747
748
    /**
749
     * Return's the repository to access the URL rewrites.
750
     *
751
     * @return \TechDivision\Import\Repositories\UrlRewriteRepositoryInterface The repository instance
752
     */
753
    public function getUrlRewriteRepository()
754
    {
755
        return $this->urlRewriteRepository;
756
    }
757
758
    /**
759
     * Set's the action with the store CRUD methods.
760
     *
761
     * @param \TechDivision\Import\Actions\ActionInterface $storeAction The action with the store CRUD methods
762
     *
763
     * @return void
764
     */
765
    public function setStoreAction(ActionInterface $storeAction)
766
    {
767
        $this->storeAction = $storeAction;
768
    }
769
770
    /**
771
     * Return's the action with the store CRUD methods.
772
     *
773
     * @return \TechDivision\Import\Actions\ActionInterface The action instance
774
     */
775
    public function getStoreAction()
776
    {
777
        return $this->storeAction;
778
    }
779
780
    /**
781
     * Set's the action with the store group CRUD methods.
782
     *
783
     * @param \TechDivision\Import\Actions\ActionInterface $storeGroupAction The action with the store group CRUD methods
784
     *
785
     * @return void
786
     */
787
    public function setStoreGroupAction(ActionInterface $storeGroupAction)
788
    {
789
        $this->storeGroupAction = $storeGroupAction;
790
    }
791
792
    /**
793
     * Return's the action with the store group CRUD methods.
794
     *
795
     * @return \TechDivision\Import\Actions\ActionInterface The action instance
796
     */
797
    public function getStoreGroupAction()
798
    {
799
        return $this->storeGroupAction;
800
    }
801
802
    /**
803
     * Set's the action with the store website CRUD methods.
804
     *
805
     * @param \TechDivision\Import\Actions\ActionInterface $storeWebsiteAction The action with the store website CRUD methods
806
     *
807
     * @return void
808
     */
809
    public function setStoreWebsiteAction(ActionInterface $storeWebsiteAction)
810
    {
811
        $this->storeWebsiteAction = $storeWebsiteAction;
812
    }
813
814
    /**
815
     * Return's the action with the store website CRUD methods.
816
     *
817
     * @return \TechDivision\Import\Actions\ActionInterface The action instance
818
     */
819
    public function getStoreWebsiteAction()
820
    {
821
        return $this->storeWebsiteAction;
822
    }
823
824
    /**
825
     * Set's the action with the import history CRUD methods.
826
     *
827
     * @param \TechDivision\Import\Actions\ActionInterface $importHistoryAction The action with the import history CRUD methods
828
     *
829
     * @return void
830
     */
831
    public function setImportHistoryAction(ActionInterface $importHistoryAction)
832
    {
833
        $this->importHistoryAction = $importHistoryAction;
834
    }
835
836
    /**
837
     * Return's the action with the import history CRUD methods.
838
     *
839
     * @return \TechDivision\Import\Actions\ActionInterface The action instance
840
     */
841
    public function getImportHistoryAction()
842
    {
843
        return $this->importHistoryAction;
844
    }
845
846
    /**
847
     * Return's the EAV attribute set with the passed ID.
848
     *
849
     * @param integer $id The ID of the EAV attribute set to load
850
     *
851
     * @return array The EAV attribute set
852
     */
853
    public function getEavAttributeSet($id)
854
    {
855
        return $this->getEavAttributeSetRepository()->load($id);
856
    }
857
858
    /**
859
     * Return's the attribute sets for the passed entity type ID.
860
     *
861
     * @param mixed $entityTypeId The entity type ID to return the attribute sets for
862
     *
863
     * @return array|boolean The attribute sets for the passed entity type ID
864
     */
865
    public function getEavAttributeSetsByEntityTypeId($entityTypeId)
866
    {
867
        return $this->getEavAttributeSetRepository()->findAllByEntityTypeId($entityTypeId);
868
    }
869
870
    /**
871
     * Return's the attribute groups for the passed attribute set ID, whereas the array
872
     * is prepared with the attribute group names as keys.
873
     *
874
     * @param mixed $attributeSetId The EAV attribute set ID to return the attribute groups for
875
     *
876
     * @return array|boolean The EAV attribute groups for the passed attribute ID
877
     */
878
    public function getEavAttributeGroupsByAttributeSetId($attributeSetId)
879
    {
880
        return $this->getEavAttributeGroupRepository()->findAllByAttributeSetId($attributeSetId);
881
    }
882
883
    /**
884
     * Load's and return's the available EAV attribute option values by the passed entity type and store ID.
885
     *
886
     * @param integer $entityTypeId The entity type ID of the attribute option values to return
887
     * @param integer $storeId      The store ID of the attribute option values to return
888
     *
889
     * @return array The EAV attribute option values
890
     */
891
    public function getEavAttributeOptionValuesByEntityTypeIdAndStoreId($entityTypeId, $storeId)
892
    {
893
        return $this->getEavAttributeOptionValueRepository()->findAllByEntityTypeIdAndStoreId($entityTypeId, $storeId);
894
    }
895
896
    /**
897
     * Return's an array with the EAV attributes for the passed entity type ID and attribute set name.
898
     *
899
     * @param integer $entityTypeId     The entity type ID of the EAV attributes to return
900
     * @param string  $attributeSetName The attribute set name of the EAV attributes to return
901
     *
902
     * @return array The
903
     */
904
    public function getEavAttributesByEntityTypeIdAndAttributeSetName($entityTypeId, $attributeSetName)
905
    {
906
        return $this->getEavAttributeRepository()->findAllByEntityTypeIdAndAttributeSetName($entityTypeId, $attributeSetName);
907
    }
908
909
    /**
910
     * Return's an array with the available EAV attributes for the passed option value and store ID.
911
     *
912
     * @param string $optionValue The option value of the EAV attributes
913
     * @param string $storeId     The store ID of the EAV attribues
914
     *
915
     * @return array The array with all available EAV attributes
916
     */
917
    public function getEavAttributesByOptionValueAndStoreId($optionValue, $storeId)
918
    {
919
        return $this->getEavAttributeRepository()->findAllByOptionValueAndStoreId($optionValue, $storeId);
920
    }
921
922
    /**
923
     * Return's the first EAV attribute for the passed option value and store ID.
924
     *
925
     * @param string $optionValue The option value of the EAV attributes
926
     * @param string $storeId     The store ID of the EAV attribues
927
     *
928
     * @return array The array with the EAV attribute
929
     */
930
    public function getEavAttributeByOptionValueAndStoreId($optionValue, $storeId)
931
    {
932
        return $this->getEavAttributeRepository()->findOneByOptionValueAndStoreId($optionValue, $storeId);
933
    }
934
935
    /**
936
     * Return's an array with the available EAV attributes for the passed is user defined flag.
937
     *
938
     * @param integer $isUserDefined The flag itself
939
     *
940
     * @return array The array with the EAV attributes matching the passed flag
941
     */
942
    public function getEavAttributesByIsUserDefined($isUserDefined = 1)
943
    {
944
        return $this->getEavAttributeRepository()->findAllByIsUserDefined($isUserDefined);
945
    }
946
947
    /**
948
     * Return's an array with the available EAV attributes for the passed is entity type and
949
     * user defined flag.
950
     *
951
     * @param integer $entityTypeId  The entity type ID of the EAV attributes to return
952
     * @param integer $isUserDefined The flag itself
953
     *
954
     * @return array The array with the EAV attributes matching the passed entity type and user defined flag
955
     */
956
    public function getEavAttributesByEntityTypeIdAndIsUserDefined($entityTypeId, $isUserDefined = 1)
957
    {
958
        return $this->getEavAttributeRepository()->findAllByEntityTypeIdAndIsUserDefined($entityTypeId, $isUserDefined);
959
    }
960
961
    /**
962
     * Return's an array with the availabe EAV attributes for the passed entity type.
963
     *
964
     * @param integer $entityTypeId The entity type ID of the EAV attributes to return
965
     *
966
     * @return array The array with the EAV attributes matching the passed entity type
967
     */
968
    public function getEavAttributesByEntityTypeId($entityTypeId)
969
    {
970
        return $this->getEavAttributeRepository()->findAllByEntityTypeId($entityTypeId);
971
    }
972
973
    /**
974
     * Return's the EAV attribute with the passed entity type ID and code.
975
     *
976
     * @param integer $entityTypeId  The entity type ID of the EAV attribute to return
977
     * @param string  $attributeCode The code of the EAV attribute to return
978
     *
979
     * @return array The EAV attribute
980
     */
981
    public function getEavAttributeByEntityTypeIdAndAttributeCode($entityTypeId, $attributeCode)
982
    {
983
        return $this->getEavAttributeRepository()->findOneByEntityTypeIdAndAttributeCode($entityTypeId, $attributeCode);
984
    }
985
986
    /**
987
     * Return's an EAV entity type with the passed entity type code.
988
     *
989
     * @param string $entityTypeCode The code of the entity type to return
990
     *
991
     * @return array The entity type with the passed entity type code
992
     */
993
    public function getEavEntityTypeByEntityTypeCode($entityTypeCode)
994
    {
995
        return $this->getEavEntityTypeRepository()->findOneByEntityTypeCode($entityTypeCode);
996
    }
997
998
    /**
999
     * Return's an array with all available EAV entity types with the entity type code as key.
1000
     *
1001
     * @return array The available link types
1002
     */
1003
    public function getEavEntityTypes()
1004
    {
1005
        return $this->getEavEntityTypeRepository()->findAll();
1006
    }
1007
1008
    /**
1009
     * Return's an array with the available stores.
1010
     *
1011
     * @return array The array with the available stores
1012
     */
1013
    public function getStores()
1014
    {
1015
        return $this->getStoreRepository()->findAll();
1016
    }
1017
1018
    /**
1019
     * Return's the default store.
1020
     *
1021
     * @return array The default store
1022
     */
1023
    public function getDefaultStore()
1024
    {
1025
        return $this->getStoreRepository()->findOneByDefault();
1026
    }
1027
1028
    /**
1029
     * Return's an array with the available store websites.
1030
     *
1031
     * @return array The array with the available store websites
1032
     */
1033
    public function getStoreWebsites()
1034
    {
1035
        return $this->getStoreWebsiteRepository()->findAll();
1036
    }
1037
1038
    /**
1039
     * Return's an array with the available tax classes.
1040
     *
1041
     * @return array The array with the available tax classes
1042
     */
1043
    public function getTaxClasses()
1044
    {
1045
        return $this->getTaxClassRepository()->findAll();
1046
    }
1047
1048
    /**
1049
     * Return's an array with all available categories.
1050
     *
1051
     * @return array The available categories
1052
     */
1053
    public function getCategories()
1054
    {
1055
        return $this->getCategoryRepository()->findAll();
1056
    }
1057
1058
    /**
1059
     * Return's an array with the root categories with the store code as key.
1060
     *
1061
     * @return array The root categories
1062
     */
1063
    public function getRootCategories()
1064
    {
1065
        return $this->getCategoryRepository()->findAllRootCategories();
1066
    }
1067
1068
    /**
1069
     * Returns the category varchar values for the categories with
1070
     * the passed with the passed entity IDs.
1071
     *
1072
     * @param array $entityIds The array with the category IDs
1073
     *
1074
     * @return mixed The category varchar values
1075
     */
1076
    public function getCategoryVarcharsByEntityIds(array $entityIds)
1077
    {
1078
        return $this->getCategoryVarcharRepository()->findAllByEntityIds($entityIds);
1079
    }
1080
1081
    /**
1082
     * Return's an array with all available link types.
1083
     *
1084
     * @return array The available link types
1085
     */
1086
    public function getLinkTypes()
1087
    {
1088
        return $this->getLinkTypeRepository()->findAll();
1089
    }
1090
1091
    /**
1092
     * Return's an array with all available link attributes.
1093
     *
1094
     * @return array The available link attributes
1095
     */
1096
    public function getLinkAttributes()
1097
    {
1098
        return $this->getLinkAttributeRepository()->findAll();
1099
    }
1100
1101
    /**
1102
     * Return's an array with all available image types.
1103
     *
1104
     * @return array The available image types
1105
     */
1106
    public function getImageTypes()
1107
    {
1108
        return $this->getImageTypeRepository()->findAll();
1109
    }
1110
1111
    /**
1112
     * Return's an array with the Magento 2 configuration.
1113
     *
1114
     * @return array The Magento 2 configuration
1115
     */
1116
    public function getCoreConfigData()
1117
    {
1118
        return $this->getCoreConfigDataRepository()->findAll();
1119
    }
1120
1121
    /**
1122
     * Returns the customer groups.
1123
     *
1124
     * @return array The customer groups
1125
     */
1126
    public function getCustomerGroups()
1127
    {
1128
        return $this->getCustomerGroupRepository()->findAll();
1129
    }
1130
1131
    /**
1132
     * Return's an array with all available admin users.
1133
     *
1134
     * @return array The available admin users
1135
     */
1136
    public function getAdminUsers()
1137
    {
1138
        return $this->getAdminUserRepository()->findAll();
1139
    }
1140
1141
    /**
1142
     * Load's and return's the admin user with the passed username.
1143
     *
1144
     * @param string $username The username of the admin user to return
1145
     *
1146
     * @return array|null The admin user with the passed username
1147
     */
1148
    public function getAdminUserByUsername($username)
1149
    {
1150
        return $this->getAdminUserRepository()->findOneByUsername($username);
1151
    }
1152
1153
    /**
1154
     * Persist's the passed store.
1155
     *
1156
     * @param array $store The store to persist
1157
     *
1158
     * @return void
1159
     */
1160
    public function persistStore(array $store)
1161
    {
1162
        return $this->getStoreAction()->persist($store);
1163
    }
1164
1165
    /**
1166
     * Persist's the passed store group.
1167
     *
1168
     * @param array $storeGroup The store group to persist
1169
     *
1170
     * @return void
1171
     */
1172
    public function persistStoreGroup(array $storeGroup)
1173
    {
1174
        return $this->getStoreGroupAction()->persist($storeGroup);
1175
    }
1176
1177
    /**
1178
     * Persist's the passed store website.
1179
     *
1180
     * @param array $storeWebsite The store website to persist
1181
     *
1182
     * @return void
1183
     */
1184
    public function persistStoreWebsite(array $storeWebsite)
1185
    {
1186
        return $this->getStoreWebsiteAction()->persist($storeWebsite);
1187
    }
1188
1189
    /**
1190
     * Persist's the passed import history.
1191
     *
1192
     * @param array $importHistory The import history to persist
1193
     *
1194
     * @return void
1195
     */
1196
    public function persistImportHistory(array $importHistory)
1197
    {
1198
        return $this->getImportHistoryAction()->persist($importHistory);
1199
    }
1200
1201
    /**
1202
     * Returns the array with the global data necessary for the
1203
     * import process.
1204
     *
1205
     * @return array The array with the global data
1206
     */
1207
    public function getGlobalData()
1208
    {
1209
1210
        // initialize the array for the global data
1211
        $globalData = array();
1212
1213
        // initialize the global data
1214
        $globalData[RegistryKeys::STORES] = $this->getStores();
1215
        $globalData[RegistryKeys::LINK_TYPES] = $this->getLinkTypes();
1216
        $globalData[RegistryKeys::TAX_CLASSES] = $this->getTaxClasses();
1217
        $globalData[RegistryKeys::IMAGE_TYPES] = $this->getImageTypes();
1218
        $globalData[RegistryKeys::DEFAULT_STORE] = $this->getDefaultStore();
1219
        $globalData[RegistryKeys::STORE_WEBSITES] = $this->getStoreWebsites();
1220
        $globalData[RegistryKeys::LINK_ATTRIBUTES] = $this->getLinkAttributes();
1221
        $globalData[RegistryKeys::ROOT_CATEGORIES] = $this->getRootCategories();
1222
        $globalData[RegistryKeys::CUSTOMER_GROUPS] = $this->getCustomerGroups();
1223
        $globalData[RegistryKeys::CORE_CONFIG_DATA] = $this->getCoreConfigData();
1224
        $globalData[RegistryKeys::ENTITY_TYPES] = $eavEntityTypes = $this->getEavEntityTypes();
1225
        $globalData[RegistryKeys::URL_REWRITES] = $this->getUrlRewriteRepository()->findAllGroupedByRequestPathAndStoreId();
1226
1227
        // prepare the attribute sets
1228
        $eavAttributes = array();
1229
        $eavAttributeSets = array();
1230
        $eavAttributeGroups = array();
1231
        foreach ($eavEntityTypes as $eavEntityTypeCode => $eavEntityType) {
1232
            // load the attribute sets for the entity type
1233
            $attributeSets = $this->getEavAttributeSetsByEntityTypeId($entityTypeId = $eavEntityType[MemberNames::ENTITY_TYPE_ID]);
1234
            // append the attribute sets to the array
1235
            $eavAttributeSets[$eavEntityTypeCode] = $attributeSets;
1236
1237
            // iterate over the attribute sets and initialize the attributes
1238
            foreach ($attributeSets as $attributeSet) {
0 ignored issues
show
Bug introduced by
The expression $attributeSets of type array|boolean is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
1239
                // load the attribute set name
1240
                $eavAttributeSetName = $attributeSet[MemberNames::ATTRIBUTE_SET_NAME];
1241
                // load the attributes for the attribute set
1242
                $eavAttributes[$eavEntityTypeCode][$eavAttributeSetName] = $this->getEavAttributesByEntityTypeIdAndAttributeSetName(
1243
                    $entityTypeId,
1244
                    $eavAttributeSetName
1245
                );
1246
                // load the attribute group for the attribute set
1247
                $eavAttributeGroups[$eavEntityTypeCode][$eavAttributeSetName] = $this->getEavAttributeGroupsByAttributeSetId(
1248
                    $attributeSet[MemberNames::ATTRIBUTE_SET_ID]
1249
                );
1250
            }
1251
        }
1252
1253
        // prepare the user defined attributes
1254
        $eavUserDefinedAttributes = array();
1255
        foreach ($eavEntityTypes as $eavEntityTypeCode => $eavEntityType) {
1256
            // load the user defined attributes for the entity type
1257
            $eavUserDefinedAttributes[$eavEntityTypeCode] = $this->getEavAttributesByEntityTypeIdAndIsUserDefined(
1258
                $eavEntityType[MemberNames::ENTITY_TYPE_ID]
1259
            );
1260
        }
1261
1262
        // initialize the arrays with the EAV attributes, EAV user defined attributes and attribute sets/groups
1263
        $globalData[RegistryKeys::EAV_ATTRIBUTES] = $eavAttributes;
1264
        $globalData[RegistryKeys::ATTRIBUTE_SETS] = $eavAttributeSets;
1265
        $globalData[RegistryKeys::ATTRIBUTE_GROUPS] = $eavAttributeGroups;
1266
        $globalData[RegistryKeys::EAV_USER_DEFINED_ATTRIBUTES] = $eavUserDefinedAttributes;
1267
1268
        // initialize categories per store view
1269
        $globalData[RegistryKeys::CATEGORIES] = array();
1270
        foreach ($globalData[RegistryKeys::STORES] as $storeView) {
1271
            $storeViewCode = $storeView[MemberNames::CODE];
1272
            $storeViewId = $storeView[MemberNames::STORE_ID];
1273
            $globalData[RegistryKeys::CATEGORIES][$storeViewCode] = $this->categoryAssembler->getCategoriesWithResolvedPathByStoreView($storeViewId);
1274
        }
1275
1276
        // return the array
1277
        return $globalData;
1278
    }
1279
}
1280