Completed
Push — master ( 3a08fe...aee93b )
by Tim
18:05 queued 16:13
created

ImportProcessor::getUrlRewriteRepository()   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 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\Dbal\Actions\ActionInterface;
26
use TechDivision\Import\Dbal\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
use TechDivision\Import\Serializer\Csv\Services\EavAttributeAwareProcessorInterface;
46
47
/**
48
 * Processor implementation to load global data.
49
 *
50
 * @author    Tim Wagner <[email protected]>
51
 * @copyright 2016 TechDivision GmbH <[email protected]>
52
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
53
 * @link      https://github.com/techdivision/import
54
 * @link      http://www.techdivision.com
55
 */
56
class ImportProcessor implements ImportProcessorInterface, EavAttributeAwareProcessorInterface
57
{
58
59
    /**
60
     * A connection to use.
61
     *
62
     * @var \TechDivision\Import\Dbal\Connection\ConnectionInterface
63
     */
64
    protected $connection;
65
66
    /**
67
     * The category assembler instance.
68
     *
69
     * @var \TechDivision\Import\Assembler\CategoryAssemblerInterface
70
     */
71
    protected $categoryAssembler;
72
73
    /**
74
     * The repository to access categories.
75
     *
76
     * @var \TechDivision\Import\Repositories\CategoryRepository
77
     */
78
    protected $categoryRepository;
79
80
    /**
81
     * The repository to access category varchar values.
82
     *
83
     * @var \TechDivision\Import\Repositories\CategoryVarcharRepositoryInterface
84
     */
85
    protected $categoryVarcharRepository;
86
87
    /**
88
     * The repository to access EAV attributes.
89
     *
90
     * @var \TechDivision\Import\Repositories\EavAttributeRepositoryInterface
91
     */
92
    protected $eavAttributeRepository;
93
94
    /**
95
     * The repository to access EAV attribute sets.
96
     *
97
     * @var \TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface
98
     */
99
    protected $eavAttributeSetRepository;
100
101
    /**
102
     * The repository to access EAV attribute groups.
103
     *
104
     * @var \TechDivision\Import\Repositories\EavAttributeGroupRepositoryInterface
105
     */
106
    protected $eavAttributeGroupRepository;
107
108
    /**
109
     * The repository to access EAV attribute groups.
110
     *
111
     * @var \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface
112
     */
113
    protected $eavAttributeOptionValueRepository;
114
115
    /**
116
     * The repository to access EAV entity types.
117
     *
118
     * @var \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface
119
     */
120
    protected $eavEntityTypeRepository;
121
122
    /**
123
     * The repository to access stores.
124
     *
125
     * @var \TechDivision\Import\Repositories\StoreRepositoryInterface
126
     */
127
    protected $storeRepository;
128
129
    /**
130
     * The repository to access store websites.
131
     *
132
     * @var \TechDivision\Import\Repositories\StoreWebsiteRepositoryInterface
133
     */
134
    protected $storeWebsiteRepository;
135
136
    /**
137
     * The repository to access tax classes.
138
     *
139
     * @var \TechDivision\Import\Repositories\TaxClassRepositoryInterface
140
     */
141
    protected $taxClassRepository;
142
143
    /**
144
     * The repository to access link types.
145
     *
146
     * @var \TechDivision\Import\Repositories\LinkTypeRepositoryInterface
147
     */
148
    protected $linkTypeRepository;
149
150
    /**
151
     * The repository to access image types.
152
     *
153
     * @var \TechDivision\Import\Repositories\ImageTypeRepositoryInterface
154
     */
155
    protected $imageTypeRepository;
156
157
    /**
158
     * The repository to access link attributes.
159
     *
160
     * @var \TechDivision\Import\Repositories\LinkAttributeRepositoryInterface
161
     */
162
    protected $linkAttributeRepository;
163
164
    /**
165
     * The repository to access the configuration.
166
     *
167
     * @var \TechDivision\Import\Repositories\CoreConfigDataRepositoryInterface
168
     */
169
    protected $coreConfigDataRepository;
170
171
    /**
172
     * The repository to access the customer groups.
173
     *
174
     * @var \TechDivision\Import\Repositories\CustomerGroupRepositoryInterface
175
     */
176
    protected $customerGroupRepository;
177
178
    /**
179
     * The repository to access the admin user.
180
     *
181
     * @var \TechDivision\Import\Repositories\AdminUserRepositoryInterface
182
     */
183
    protected $adminUserRepository;
184
185
    /**
186
     * The repository to access the URL rewrites.
187
     *
188
     * @var \TechDivision\Import\Repositories\UrlRewriteRepositoryInterface
189
     */
190
    protected $urlRewriteRepository;
191
192
    /**
193
     * The action for store CRUD methods.
194
     *
195
     * @var \TechDivision\Import\Dbal\Actions\ActionInterface
196
     */
197
    protected $storeAction;
198
199
    /**
200
     * The action for store group CRUD methods.
201
     *
202
     * @var \TechDivision\Import\Dbal\Actions\ActionInterface
203
     */
204
    protected $storeGroupAction;
205
206
    /**
207
     * The action for store website CRUD methods.
208
     *
209
     * @var \TechDivision\Import\Dbal\Actions\ActionInterface
210
     */
211
    protected $storeWebsiteAction;
212
213
    /**
214
     * The action for import history CRUD methods.
215
     *
216
     * @var \TechDivision\Import\Dbal\Actions\ActionInterface
217
     */
218
    protected $importHistoryAction;
219
220
    /**
221
     * Initialize the processor with the necessary assembler and repository instances.
222
     *
223
     * @param \TechDivision\Import\Dbal\Connection\ConnectionInterface                     $connection                        The connection to use
224
     * @param \TechDivision\Import\Assembler\CategoryAssemblerInterface                    $categoryAssembler                 The category assembler instance
225
     * @param \TechDivision\Import\Repositories\CategoryRepositoryInterface                $categoryRepository                The repository to access categories
226
     * @param \TechDivision\Import\Repositories\CategoryVarcharRepositoryInterface         $categoryVarcharRepository         The repository to access category varchar values
227
     * @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface            $eavAttributeRepository            The repository to access EAV attributes
228
     * @param \TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface         $eavAttributeSetRepository         The repository to access EAV attribute sets
229
     * @param \TechDivision\Import\Repositories\EavAttributeGroupRepositoryInterface       $eavAttributeGroupRepository       The repository to access EAV attribute groups
230
     * @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository The repository to access EAV attribute option value repository
231
     * @param \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface           $eavEntityTypeRepository           The repository to access EAV entity types
232
     * @param \TechDivision\Import\Repositories\StoreRepositoryInterface                   $storeRepository                   The repository to access stores
233
     * @param \TechDivision\Import\Repositories\StoreWebsiteRepositoryInterface            $storeWebsiteRepository            The repository to access store websites
234
     * @param \TechDivision\Import\Repositories\TaxClassRepositoryInterface                $taxClassRepository                The repository to access tax classes
235
     * @param \TechDivision\Import\Repositories\LinkTypeRepositoryInterface                $linkTypeRepository                The repository to access link types
236
     * @param \TechDivision\Import\Repositories\LinkAttributeRepositoryInterface           $linkAttributeRepository           The repository to access link attributes
237
     * @param \TechDivision\Import\Repositories\CoreConfigDataRepositoryInterface          $coreConfigDataRepository          The repository to access the configuration
238
     * @param \TechDivision\Import\Repositories\CustomerGroupRepositoryInterface           $customerGroupRepository           The repository to access the customer groups
239
     * @param \TechDivision\Import\Repositories\ImageTypeRepositoryInterface               $imageTypeRepository               The repository to access images types
240
     * @param \TechDivision\Import\Repositories\AdminUserRepositoryInterface               $adminUserRepository               The repository to access admin users
241
     * @param \TechDivision\Import\Repositories\UrlRewriteRepositoryInterface              $urlRewriteRepository              The repository to access URL rewrites
242
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface                            $storeAction                       The action with the store CRUD methods
243
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface                            $storeGroupAction                  The action with the store group CRUD methods
244
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface                            $storeWebsiteAction                The action with the store website CRUD methods
245
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface                            $importHistoryAction               The action with the import history CRUD methods
246
     */
247
    public function __construct(
248
        ConnectionInterface $connection,
249
        CategoryAssemblerInterface $categoryAssembler,
250
        CategoryRepositoryInterface $categoryRepository,
251
        CategoryVarcharRepositoryInterface $categoryVarcharRepository,
252
        EavAttributeRepositoryInterface $eavAttributeRepository,
253
        EavAttributeSetRepositoryInterface $eavAttributeSetRepository,
254
        EavAttributeGroupRepositoryInterface $eavAttributeGroupRepository,
255
        EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository,
256
        EavEntityTypeRepositoryInterface $eavEntityTypeRepository,
257
        StoreRepositoryInterface $storeRepository,
258
        StoreWebsiteRepositoryInterface $storeWebsiteRepository,
259
        TaxClassRepositoryInterface $taxClassRepository,
260
        LinkTypeRepositoryInterface $linkTypeRepository,
261
        LinkAttributeRepositoryInterface $linkAttributeRepository,
262
        CoreConfigDataRepositoryInterface $coreConfigDataRepository,
263
        CustomerGroupRepositoryInterface $customerGroupRepository,
264
        ImageTypeRepositoryInterface $imageTypeRepository,
265
        AdminUserRepositoryInterface $adminUserRepository,
266
        UrlRewriteRepositoryInterface $urlRewriteRepository,
267
        ActionInterface $storeAction,
268
        ActionInterface $storeGroupAction,
269
        ActionInterface $storeWebsiteAction,
270
        ActionInterface $importHistoryAction
271
    ) {
272
        $this->setConnection($connection);
273
        $this->setCategoryAssembler($categoryAssembler);
274
        $this->setCategoryRepository($categoryRepository);
275
        $this->setCategoryVarcharRepository($categoryVarcharRepository);
276
        $this->setEavAttributeRepository($eavAttributeRepository);
277
        $this->setEavAttributeSetRepository($eavAttributeSetRepository);
278
        $this->setEavAttributeGroupRepository($eavAttributeGroupRepository);
279
        $this->setEavAttributeOptionValueRepository($eavAttributeOptionValueRepository);
280
        $this->setEavEntityTypeRepository($eavEntityTypeRepository);
281
        $this->setStoreRepository($storeRepository);
282
        $this->setStoreWebsiteRepository($storeWebsiteRepository);
283
        $this->setTaxClassRepository($taxClassRepository);
284
        $this->setLinkTypeRepository($linkTypeRepository);
285
        $this->setLinkAttributeRepository($linkAttributeRepository);
286
        $this->setCoreConfigDataRepository($coreConfigDataRepository);
287
        $this->setImageTypeRepository($imageTypeRepository);
288
        $this->setCustomerGroupRepository($customerGroupRepository);
289
        $this->setAdminUserRepository($adminUserRepository);
290
        $this->setUrlRewriteRepository($urlRewriteRepository);
291
        $this->setStoreAction($storeAction);
292
        $this->setStoreGroupAction($storeGroupAction);
293
        $this->setStoreWebsiteAction($storeWebsiteAction);
294
        $this->setImportHistoryAction($importHistoryAction);
295
    }
296
297
    /**
298
     * Set's the passed connection.
299
     *
300
     * @param \TechDivision\Import\Dbal\Connection\ConnectionInterface $connection The connection to set
301
     *
302
     * @return void
303
     */
304
    public function setConnection(ConnectionInterface $connection)
305
    {
306
        $this->connection = $connection;
307
    }
308
309
    /**
310
     * Return's the connection.
311
     *
312
     * @return \TechDivision\Import\Dbal\Connection\ConnectionInterface The connection instance
313
     */
314
    public function getConnection()
315
    {
316
        return $this->connection;
317
    }
318
319
    /**
320
     * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO
321
     * object instance are not committed until you end the transaction by calling ProductProcessor::commit().
322
     * Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection
323
     * to autocommit mode.
324
     *
325
     * @return boolean Returns TRUE on success or FALSE on failure
326
     * @link http://php.net/manual/en/pdo.begintransaction.php
327
     */
328
    public function beginTransaction()
329
    {
330
        return $this->connection->beginTransaction();
331
    }
332
333
    /**
334
     * Commits a transaction, returning the database connection to autocommit mode until the next call to
335
     * ProductProcessor::beginTransaction() starts a new transaction.
336
     *
337
     * @return boolean Returns TRUE on success or FALSE on failure
338
     * @link http://php.net/manual/en/pdo.commit.php
339
     */
340
    public function commit()
341
    {
342
        return $this->connection->commit();
343
    }
344
345
    /**
346
     * Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction().
347
     *
348
     * If the database was set to autocommit mode, this function will restore autocommit mode after it has
349
     * rolled back the transaction.
350
     *
351
     * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition
352
     * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit
353
     * COMMIT will prevent you from rolling back any other changes within the transaction boundary.
354
     *
355
     * @return boolean Returns TRUE on success or FALSE on failure
356
     * @link http://php.net/manual/en/pdo.rollback.php
357
     */
358
    public function rollBack()
359
    {
360
        return $this->connection->rollBack();
361
    }
362
363
    /**
364
     * Set's the category assembler.
365
     *
366
     * @param \TechDivision\Import\Assembler\CategoryAssemblerInterface $categoryAssembler The category assembler
367
     *
368
     * @return void
369
     */
370
    public function setCategoryAssembler($categoryAssembler)
371
    {
372
        $this->categoryAssembler = $categoryAssembler;
373
    }
374
375
    /**
376
     * Return's the category assembler.
377
     *
378
     * @return \TechDivision\Import\Assembler\CategoryAssemblerInterface The category assembler instance
379
     */
380
    public function getCategoryAssembler()
381
    {
382
        return $this->categoryAssembler;
383
    }
384
385
    /**
386
     * Set's the repository to access categories.
387
     *
388
     * @param \TechDivision\Import\Repositories\CategoryRepositoryInterface $categoryRepository The repository to access categories
389
     *
390
     * @return void
391
     */
392
    public function setCategoryRepository(CategoryRepositoryInterface $categoryRepository)
393
    {
394
        $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...
395
    }
396
397
    /**
398
     * Return's the repository to access categories.
399
     *
400
     * @return \TechDivision\Import\Repositories\CategoryRepositoryInterface The repository instance
401
     */
402
    public function getCategoryRepository()
403
    {
404
        return $this->categoryRepository;
405
    }
406
407
    /**
408
     * Return's the repository to access category varchar values.
409
     *
410
     * @param \TechDivision\Import\Repositories\CategoryVarcharRepositoryInterface $categoryVarcharRepository The repository instance
411
     *
412
     * @return void
413
     */
414
    public function setCategoryVarcharRepository(CategoryVarcharRepositoryInterface $categoryVarcharRepository)
415
    {
416
        $this->categoryVarcharRepository = $categoryVarcharRepository;
417
    }
418
419
    /**
420
     * Return's the repository to access category varchar values.
421
     *
422
     * @return \TechDivision\Import\Repositories\CategoryVarcharRepositoryInterface The repository instance
423
     */
424
    public function getCategoryVarcharRepository()
425
    {
426
        return $this->categoryVarcharRepository;
427
    }
428
429
    /**
430
     * Set's the repository to access EAV attributes.
431
     *
432
     * @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface $eavAttributeRepository The repository to access EAV attributes
433
     *
434
     * @return void
435
     */
436
    public function setEavAttributeRepository(EavAttributeRepositoryInterface $eavAttributeRepository)
437
    {
438
        $this->eavAttributeRepository = $eavAttributeRepository;
439
    }
440
441
    /**
442
     * Return's the repository to access EAV attributes.
443
     *
444
     * @return \TechDivision\Import\Repositories\EavAttributeRepositoryInterface The repository instance
445
     */
446
    public function getEavAttributeRepository()
447
    {
448
        return $this->eavAttributeRepository;
449
    }
450
451
    /**
452
     * Set's the repository to access EAV attribute sets.
453
     *
454
     * @param \TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface $eavAttributeSetRepository The repository the access EAV attribute sets
455
     *
456
     * @return void
457
     */
458
    public function setEavAttributeSetRepository(EavAttributeSetRepositoryInterface $eavAttributeSetRepository)
459
    {
460
        $this->eavAttributeSetRepository = $eavAttributeSetRepository;
461
    }
462
463
    /**
464
     * Return's the repository to access EAV attribute sets.
465
     *
466
     * @return \TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface The repository instance
467
     */
468
    public function getEavAttributeSetRepository()
469
    {
470
        return $this->eavAttributeSetRepository;
471
    }
472
473
    /**
474
     * Set's the repository to access EAV attribute groups.
475
     *
476
     * @param \TechDivision\Import\Repositories\EavAttributeGroupRepositoryInterface $eavAttributeGroupRepository The repository the access EAV attribute groups
477
     *
478
     * @return void
479
     */
480
    public function setEavAttributeGroupRepository(EavAttributeGroupRepositoryInterface $eavAttributeGroupRepository)
481
    {
482
        $this->eavAttributeGroupRepository = $eavAttributeGroupRepository;
483
    }
484
485
    /**
486
     * Return's the repository to access EAV attribute groups.
487
     *
488
     * @return \TechDivision\Import\Repositories\EavAttributeGroupRepositoryInterface The repository instance
489
     */
490
    public function getEavAttributeGroupRepository()
491
    {
492
        return $this->eavAttributeGroupRepository;
493
    }
494
495
    /**
496
     * Set's the repository to access EAV attribute option values.
497
     *
498
     * @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository The repository the access EAV attribute option values
499
     *
500
     * @return void
501
     */
502
    public function setEavAttributeOptionValueRepository(EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository)
503
    {
504
        $this->eavAttributeOptionValueRepository = $eavAttributeOptionValueRepository;
505
    }
506
507
    /**
508
     * Return's the repository to access EAV attribute option values.
509
     *
510
     * @return \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface The repository instance
511
     */
512
    public function getEavAttributeOptionValueRepository()
513
    {
514
        return $this->eavAttributeOptionValueRepository;
515
    }
516
517
    /**
518
     * Return's the repository to access EAV entity types.
519
     *
520
     * @return \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface The repository instance
521
     */
522
    public function getEavEntityTypeRepository()
523
    {
524
        return $this->eavEntityTypeRepository;
525
    }
526
527
    /**
528
     * Set's the repository to access EAV entity types.
529
     *
530
     * @param \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface $eavEntityTypeRepository The repository the access EAV entity types
531
     *
532
     * @return void
533
     */
534
    public function setEavEntityTypeRepository(EavEntityTypeRepositoryInterface $eavEntityTypeRepository)
535
    {
536
        $this->eavEntityTypeRepository = $eavEntityTypeRepository;
537
    }
538
539
    /**
540
     * Set's the repository to access stores.
541
     *
542
     * @param \TechDivision\Import\Repositories\StoreRepositoryInterface $storeRepository The repository the access stores
543
     *
544
     * @return void
545
     */
546
    public function setStoreRepository(StoreRepositoryInterface $storeRepository)
547
    {
548
        $this->storeRepository = $storeRepository;
549
    }
550
551
    /**
552
     * Return's the repository to access stores.
553
     *
554
     * @return \TechDivision\Import\Repositories\StoreRepositoryInterface The repository instance
555
     */
556
    public function getStoreRepository()
557
    {
558
        return $this->storeRepository;
559
    }
560
561
    /**
562
     * Set's the repository to access store websites.
563
     *
564
     * @param \TechDivision\Import\Repositories\StoreWebsiteRepositoryInterface $storeWebsiteRepository The repository the access store websites
565
     *
566
     * @return void
567
     */
568
    public function setStoreWebsiteRepository(StoreWebsiteRepositoryInterface $storeWebsiteRepository)
569
    {
570
        $this->storeWebsiteRepository = $storeWebsiteRepository;
571
    }
572
573
    /**
574
     * Return's the repository to access store websites.
575
     *
576
     * @return \TechDivision\Import\Repositories\StoreWebsiteRepositoryInterface The repository instance
577
     */
578
    public function getStoreWebsiteRepository()
579
    {
580
        return $this->storeWebsiteRepository;
581
    }
582
583
    /**
584
     * Set's the repository to access tax classes.
585
     *
586
     * @param \TechDivision\Import\Repositories\TaxClassRepositoryInterface $taxClassRepository The repository the access stores
587
     *
588
     * @return void
589
     */
590
    public function setTaxClassRepository(TaxClassRepositoryInterface $taxClassRepository)
591
    {
592
        $this->taxClassRepository = $taxClassRepository;
593
    }
594
595
    /**
596
     * Return's the repository to access tax classes.
597
     *
598
     * @return \TechDivision\Import\Repositories\TaxClassRepositoryInterface The repository instance
599
     */
600
    public function getTaxClassRepository()
601
    {
602
        return $this->taxClassRepository;
603
    }
604
605
    /**
606
     * Set's the repository to access link types.
607
     *
608
     * @param \TechDivision\Import\Repositories\LinkTypeRepositoryInterface $linkTypeRepository The repository to access link types
609
     *
610
     * @return void
611
     */
612
    public function setLinkTypeRepository(LinkTypeRepositoryInterface $linkTypeRepository)
613
    {
614
        $this->linkTypeRepository = $linkTypeRepository;
615
    }
616
617
    /**
618
     * Return's the repository to access link types.
619
     *
620
     * @return \TechDivision\Import\Repositories\LinkTypeRepositoryInterface The repository instance
621
     */
622
    public function getLinkTypeRepository()
623
    {
624
        return $this->linkTypeRepository;
625
    }
626
627
    /**
628
     * Set's the repository to access link attributes.
629
     *
630
     * @param \TechDivision\Import\Repositories\LinkAttributeRepositoryInterface $linkAttributeRepository The repository to access link attributes
631
     *
632
     * @return void
633
     */
634
    public function setLinkAttributeRepository(LinkAttributeRepositoryInterface $linkAttributeRepository)
635
    {
636
        $this->linkAttributeRepository = $linkAttributeRepository;
637
    }
638
639
    /**
640
     * Return's the repository to access link attributes.
641
     *
642
     * @return \TechDivision\Import\Repositories\LinkAttributeRepositoryInterface The repository instance
643
     */
644
    public function getLinkAttributeRepository()
645
    {
646
        return $this->linkAttributeRepository;
647
    }
648
649
    /**
650
     * Set's the repository to access link types.
651
     *
652
     * @param \TechDivision\Import\Repositories\ImageTypeRepositoryInterface $imageTypeRepository The repository to access image types
653
     *
654
     * @return void
655
     */
656
    public function setImageTypeRepository(ImageTypeRepositoryInterface $imageTypeRepository)
657
    {
658
        $this->imageTypeRepository = $imageTypeRepository;
659
    }
660
661
    /**
662
     * Return's the repository to access link types.
663
     *
664
     * @return \TechDivision\Import\Repositories\ImageTypeRepositoryInterface The repository instance
665
     */
666
    public function getImageTypeRepository()
667
    {
668
        return $this->imageTypeRepository;
669
    }
670
671
    /**
672
     * Set's the repository to access the Magento 2 configuration.
673
     *
674
     * @param \TechDivision\Import\Repositories\CoreConfigDataRepositoryInterface $coreConfigDataRepository The repository to access the Magento 2 configuration
675
     *
676
     * @return void
677
     */
678
    public function setCoreConfigDataRepository(CoreConfigDataRepositoryInterface $coreConfigDataRepository)
679
    {
680
        $this->coreConfigDataRepository = $coreConfigDataRepository;
681
    }
682
683
    /**
684
     * Return's the repository to access the Magento 2 configuration.
685
     *
686
     * @return \TechDivision\Import\Repositories\CoreConfigDataRepositoryInterface The repository instance
687
     */
688
    public function getCoreConfigDataRepository()
689
    {
690
        return $this->coreConfigDataRepository;
691
    }
692
693
    /**
694
     * Set's the repository to access the customer groups.
695
     *
696
     * @param \TechDivision\Import\Repositories\CustomerGroupRepositoryInterface $customerGroupRepository The repository to access the customer groups
697
     *
698
     * @return void
699
     */
700
    public function setCustomerGroupRepository(CustomerGroupRepositoryInterface $customerGroupRepository)
701
    {
702
        $this->customerGroupRepository = $customerGroupRepository;
703
    }
704
705
    /**
706
     * Return's the repository to access the customer groups.
707
     *
708
     * @return \TechDivision\Import\Repositories\CustomerGroupRepositoryInterface The repository instance
709
     */
710
    public function getCustomerGroupRepository()
711
    {
712
        return $this->customerGroupRepository;
713
    }
714
715
    /**
716
     * Set's the repository to access the admin users.
717
     *
718
     * @param \TechDivision\Import\Repositories\AdminUserRepositoryInterface $adminUserRepository The repository to access the admin users
719
     *
720
     * @return void
721
     */
722
    public function setAdminUserRepository(AdminUserRepositoryInterface $adminUserRepository)
723
    {
724
        $this->adminUserRepository = $adminUserRepository;
725
    }
726
727
    /**
728
     * Return's the repository to access the admin users.
729
     *
730
     * @return \TechDivision\Import\Repositories\AdminUserRepositoryInterface The repository instance
731
     */
732
    public function getAdminUserRepository()
733
    {
734
        return $this->adminUserRepository;
735
    }
736
737
    /**
738
     * Set's the repository to access the URL rewrites.
739
     *
740
     * @param \TechDivision\Import\Repositories\UrlRewriteRepositoryInterface $urlRewriteRepository The repository to access the URL rewrites
741
     *
742
     * @return void
743
     */
744
    public function setUrlRewriteRepository(UrlRewriteRepositoryInterface $urlRewriteRepository)
745
    {
746
        $this->urlRewriteRepository = $urlRewriteRepository;
747
    }
748
749
    /**
750
     * Return's the repository to access the URL rewrites.
751
     *
752
     * @return \TechDivision\Import\Repositories\UrlRewriteRepositoryInterface The repository instance
753
     */
754
    public function getUrlRewriteRepository()
755
    {
756
        return $this->urlRewriteRepository;
757
    }
758
759
    /**
760
     * Set's the action with the store CRUD methods.
761
     *
762
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface $storeAction The action with the store CRUD methods
763
     *
764
     * @return void
765
     */
766
    public function setStoreAction(ActionInterface $storeAction)
767
    {
768
        $this->storeAction = $storeAction;
769
    }
770
771
    /**
772
     * Return's the action with the store CRUD methods.
773
     *
774
     * @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance
775
     */
776
    public function getStoreAction()
777
    {
778
        return $this->storeAction;
779
    }
780
781
    /**
782
     * Set's the action with the store group CRUD methods.
783
     *
784
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface $storeGroupAction The action with the store group CRUD methods
785
     *
786
     * @return void
787
     */
788
    public function setStoreGroupAction(ActionInterface $storeGroupAction)
789
    {
790
        $this->storeGroupAction = $storeGroupAction;
791
    }
792
793
    /**
794
     * Return's the action with the store group CRUD methods.
795
     *
796
     * @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance
797
     */
798
    public function getStoreGroupAction()
799
    {
800
        return $this->storeGroupAction;
801
    }
802
803
    /**
804
     * Set's the action with the store website CRUD methods.
805
     *
806
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface $storeWebsiteAction The action with the store website CRUD methods
807
     *
808
     * @return void
809
     */
810
    public function setStoreWebsiteAction(ActionInterface $storeWebsiteAction)
811
    {
812
        $this->storeWebsiteAction = $storeWebsiteAction;
813
    }
814
815
    /**
816
     * Return's the action with the store website CRUD methods.
817
     *
818
     * @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance
819
     */
820
    public function getStoreWebsiteAction()
821
    {
822
        return $this->storeWebsiteAction;
823
    }
824
825
    /**
826
     * Set's the action with the import history CRUD methods.
827
     *
828
     * @param \TechDivision\Import\Dbal\Actions\ActionInterface $importHistoryAction The action with the import history CRUD methods
829
     *
830
     * @return void
831
     */
832
    public function setImportHistoryAction(ActionInterface $importHistoryAction)
833
    {
834
        $this->importHistoryAction = $importHistoryAction;
835
    }
836
837
    /**
838
     * Return's the action with the import history CRUD methods.
839
     *
840
     * @return \TechDivision\Import\Dbal\Actions\ActionInterface The action instance
841
     */
842
    public function getImportHistoryAction()
843
    {
844
        return $this->importHistoryAction;
845
    }
846
847
    /**
848
     * Return's the EAV attribute set with the passed ID.
849
     *
850
     * @param integer $id The ID of the EAV attribute set to load
851
     *
852
     * @return array The EAV attribute set
853
     */
854
    public function getEavAttributeSet($id)
855
    {
856
        return $this->getEavAttributeSetRepository()->load($id);
857
    }
858
859
    /**
860
     * Return's the attribute sets for the passed entity type ID.
861
     *
862
     * @param mixed $entityTypeId The entity type ID to return the attribute sets for
863
     *
864
     * @return array|boolean The attribute sets for the passed entity type ID
865
     */
866
    public function getEavAttributeSetsByEntityTypeId($entityTypeId)
867
    {
868
        return $this->getEavAttributeSetRepository()->findAllByEntityTypeId($entityTypeId);
869
    }
870
871
    /**
872
     * Return's the attribute groups for the passed attribute set ID, whereas the array
873
     * is prepared with the attribute group names as keys.
874
     *
875
     * @param mixed $attributeSetId The EAV attribute set ID to return the attribute groups for
876
     *
877
     * @return array|boolean The EAV attribute groups for the passed attribute ID
878
     */
879
    public function getEavAttributeGroupsByAttributeSetId($attributeSetId)
880
    {
881
        return $this->getEavAttributeGroupRepository()->findAllByAttributeSetId($attributeSetId);
882
    }
883
884
    /**
885
     * Load's and return's the available EAV attribute option values by the passed entity type and store ID.
886
     *
887
     * @param integer $entityTypeId The entity type ID of the attribute option values to return
888
     * @param integer $storeId      The store ID of the attribute option values to return
889
     *
890
     * @return array The EAV attribute option values
891
     */
892
    public function getEavAttributeOptionValuesByEntityTypeIdAndStoreId($entityTypeId, $storeId)
893
    {
894
        return $this->getEavAttributeOptionValueRepository()->findAllByEntityTypeIdAndStoreId($entityTypeId, $storeId);
895
    }
896
897
    /**
898
     * Return's an array with the EAV attributes for the passed entity type ID and attribute set name.
899
     *
900
     * @param integer $entityTypeId     The entity type ID of the EAV attributes to return
901
     * @param string  $attributeSetName The attribute set name of the EAV attributes to return
902
     *
903
     * @return array The
904
     */
905
    public function getEavAttributesByEntityTypeIdAndAttributeSetName($entityTypeId, $attributeSetName)
906
    {
907
        return $this->getEavAttributeRepository()->findAllByEntityTypeIdAndAttributeSetName($entityTypeId, $attributeSetName);
908
    }
909
910
    /**
911
     * Return's an array with the available EAV attributes for the passed option value and store ID.
912
     *
913
     * @param string $optionValue The option value of the EAV attributes
914
     * @param string $storeId     The store ID of the EAV attribues
915
     *
916
     * @return array The array with all available EAV attributes
917
     */
918
    public function getEavAttributesByOptionValueAndStoreId($optionValue, $storeId)
919
    {
920
        return $this->getEavAttributeRepository()->findAllByOptionValueAndStoreId($optionValue, $storeId);
921
    }
922
923
    /**
924
     * Return's the first EAV attribute for the passed option value and store ID.
925
     *
926
     * @param string $optionValue The option value of the EAV attributes
927
     * @param string $storeId     The store ID of the EAV attribues
928
     *
929
     * @return array The array with the EAV attribute
930
     */
931
    public function getEavAttributeByOptionValueAndStoreId($optionValue, $storeId)
932
    {
933
        return $this->getEavAttributeRepository()->findOneByOptionValueAndStoreId($optionValue, $storeId);
934
    }
935
936
    /**
937
     * Return's an array with the available EAV attributes for the passed is user defined flag.
938
     *
939
     * @param integer $isUserDefined The flag itself
940
     *
941
     * @return array The array with the EAV attributes matching the passed flag
942
     */
943
    public function getEavAttributesByIsUserDefined($isUserDefined = 1)
944
    {
945
        return $this->getEavAttributeRepository()->findAllByIsUserDefined($isUserDefined);
946
    }
947
948
    /**
949
     * Return's an array with the available EAV attributes for the passed is entity type and
950
     * user defined flag.
951
     *
952
     * @param integer $entityTypeId  The entity type ID of the EAV attributes to return
953
     * @param integer $isUserDefined The flag itself
954
     *
955
     * @return array The array with the EAV attributes matching the passed entity type and user defined flag
956
     */
957
    public function getEavAttributesByEntityTypeIdAndIsUserDefined($entityTypeId, $isUserDefined = 1)
958
    {
959
        return $this->getEavAttributeRepository()->findAllByEntityTypeIdAndIsUserDefined($entityTypeId, $isUserDefined);
960
    }
961
962
    /**
963
     * Return's an array with the availabe EAV attributes for the passed entity type.
964
     *
965
     * @param integer $entityTypeId The entity type ID of the EAV attributes to return
966
     *
967
     * @return array The array with the EAV attributes matching the passed entity type
968
     */
969
    public function getEavAttributesByEntityTypeId($entityTypeId)
970
    {
971
        return $this->getEavAttributeRepository()->findAllByEntityTypeId($entityTypeId);
972
    }
973
974
    /**
975
     * Return's the EAV attribute with the passed entity type ID and code.
976
     *
977
     * @param int    $entityTypeId  The entity type ID of the EAV attribute to return
978
     * @param string $attributeCode The code of the EAV attribute to return
979
     *
980
     * @return array The EAV attribute
981
     */
982
    public function getEavAttributeByEntityTypeIdAndAttributeCode(int $entityTypeId, string $attributeCode)
983
    {
984
        return $this->getEavAttributeRepository()->findOneByEntityTypeIdAndAttributeCode($entityTypeId, $attributeCode);
985
    }
986
987
    /**
988
     * Return's an EAV entity type with the passed entity type code.
989
     *
990
     * @param string $entityTypeCode The code of the entity type to return
991
     *
992
     * @return array The entity type with the passed entity type code
993
     */
994
    public function getEavEntityTypeByEntityTypeCode(string $entityTypeCode)
995
    {
996
        return $this->getEavEntityTypeRepository()->findOneByEntityTypeCode($entityTypeCode);
997
    }
998
999
    /**
1000
     * Return's an array with all available EAV entity types with the entity type code as key.
1001
     *
1002
     * @return array The available link types
1003
     */
1004
    public function getEavEntityTypes()
1005
    {
1006
        return $this->getEavEntityTypeRepository()->findAll();
1007
    }
1008
1009
    /**
1010
     * Return's an array with the available stores.
1011
     *
1012
     * @return array The array with the available stores
1013
     */
1014
    public function getStores()
1015
    {
1016
        return $this->getStoreRepository()->findAll();
1017
    }
1018
1019
    /**
1020
     * Return's the default store.
1021
     *
1022
     * @return array The default store
1023
     */
1024
    public function getDefaultStore()
1025
    {
1026
        return $this->getStoreRepository()->findOneByDefault();
1027
    }
1028
1029
    /**
1030
     * Return's an array with the available store websites.
1031
     *
1032
     * @return array The array with the available store websites
1033
     */
1034
    public function getStoreWebsites()
1035
    {
1036
        return $this->getStoreWebsiteRepository()->findAll();
1037
    }
1038
1039
    /**
1040
     * Return's an array with the available tax classes.
1041
     *
1042
     * @return array The array with the available tax classes
1043
     */
1044
    public function getTaxClasses()
1045
    {
1046
        return $this->getTaxClassRepository()->findAll();
1047
    }
1048
1049
    /**
1050
     * Return's an array with all available categories.
1051
     *
1052
     * @return array The available categories
1053
     */
1054
    public function getCategories()
1055
    {
1056
        return $this->getCategoryRepository()->findAll();
1057
    }
1058
1059
    /**
1060
     * Return's an array with the root categories with the store code as key.
1061
     *
1062
     * @return array The root categories
1063
     */
1064
    public function getRootCategories()
1065
    {
1066
        return $this->getCategoryRepository()->findAllRootCategories();
1067
    }
1068
1069
    /**
1070
     * Returns the category varchar values for the categories with
1071
     * the passed with the passed entity IDs.
1072
     *
1073
     * @param array $entityIds The array with the category IDs
1074
     *
1075
     * @return mixed The category varchar values
1076
     */
1077
    public function getCategoryVarcharsByEntityIds(array $entityIds)
1078
    {
1079
        return $this->getCategoryVarcharRepository()->findAllByEntityIds($entityIds);
1080
    }
1081
1082
    /**
1083
     * Return's an array with all available link types.
1084
     *
1085
     * @return array The available link types
1086
     */
1087
    public function getLinkTypes()
1088
    {
1089
        return $this->getLinkTypeRepository()->findAll();
1090
    }
1091
1092
    /**
1093
     * Return's an array with all available link attributes.
1094
     *
1095
     * @return array The available link attributes
1096
     */
1097
    public function getLinkAttributes()
1098
    {
1099
        return $this->getLinkAttributeRepository()->findAll();
1100
    }
1101
1102
    /**
1103
     * Return's an array with all available image types.
1104
     *
1105
     * @return array The available image types
1106
     */
1107
    public function getImageTypes()
1108
    {
1109
        return $this->getImageTypeRepository()->findAll();
1110
    }
1111
1112
    /**
1113
     * Return's an array with the Magento 2 configuration.
1114
     *
1115
     * @return array The Magento 2 configuration
1116
     */
1117
    public function getCoreConfigData()
1118
    {
1119
        return $this->getCoreConfigDataRepository()->findAll();
1120
    }
1121
1122
    /**
1123
     * Returns the customer groups.
1124
     *
1125
     * @return array The customer groups
1126
     */
1127
    public function getCustomerGroups()
1128
    {
1129
        return $this->getCustomerGroupRepository()->findAll();
1130
    }
1131
1132
    /**
1133
     * Return's an array with all available admin users.
1134
     *
1135
     * @return array The available admin users
1136
     */
1137
    public function getAdminUsers()
1138
    {
1139
        return $this->getAdminUserRepository()->findAll();
1140
    }
1141
1142
    /**
1143
     * Load's and return's the admin user with the passed username.
1144
     *
1145
     * @param string $username The username of the admin user to return
1146
     *
1147
     * @return array|null The admin user with the passed username
1148
     */
1149
    public function getAdminUserByUsername($username)
1150
    {
1151
        return $this->getAdminUserRepository()->findOneByUsername($username);
1152
    }
1153
1154
    /**
1155
     * Persist's the passed store.
1156
     *
1157
     * @param array $store The store to persist
1158
     *
1159
     * @return void
1160
     */
1161
    public function persistStore(array $store)
1162
    {
1163
        return $this->getStoreAction()->persist($store);
1164
    }
1165
1166
    /**
1167
     * Persist's the passed store group.
1168
     *
1169
     * @param array $storeGroup The store group to persist
1170
     *
1171
     * @return void
1172
     */
1173
    public function persistStoreGroup(array $storeGroup)
1174
    {
1175
        return $this->getStoreGroupAction()->persist($storeGroup);
1176
    }
1177
1178
    /**
1179
     * Persist's the passed store website.
1180
     *
1181
     * @param array $storeWebsite The store website to persist
1182
     *
1183
     * @return void
1184
     */
1185
    public function persistStoreWebsite(array $storeWebsite)
1186
    {
1187
        return $this->getStoreWebsiteAction()->persist($storeWebsite);
1188
    }
1189
1190
    /**
1191
     * Persist's the passed import history.
1192
     *
1193
     * @param array $importHistory The import history to persist
1194
     *
1195
     * @return void
1196
     */
1197
    public function persistImportHistory(array $importHistory)
1198
    {
1199
        return $this->getImportHistoryAction()->persist($importHistory);
1200
    }
1201
1202
    /**
1203
     * Returns the array with the global data necessary for the
1204
     * import process.
1205
     *
1206
     * @return array The array with the global data
1207
     */
1208
    public function getGlobalData()
1209
    {
1210
1211
        // initialize the array for the global data
1212
        $globalData = array();
1213
1214
        // initialize the global data
1215
        $globalData[RegistryKeys::STORES] = $this->getStores();
1216
        $globalData[RegistryKeys::LINK_TYPES] = $this->getLinkTypes();
1217
        $globalData[RegistryKeys::TAX_CLASSES] = $this->getTaxClasses();
1218
        $globalData[RegistryKeys::IMAGE_TYPES] = $this->getImageTypes();
1219
        $globalData[RegistryKeys::DEFAULT_STORE] = $this->getDefaultStore();
1220
        $globalData[RegistryKeys::STORE_WEBSITES] = $this->getStoreWebsites();
1221
        $globalData[RegistryKeys::LINK_ATTRIBUTES] = $this->getLinkAttributes();
1222
        $globalData[RegistryKeys::ROOT_CATEGORIES] = $this->getRootCategories();
1223
        $globalData[RegistryKeys::CUSTOMER_GROUPS] = $this->getCustomerGroups();
1224
        $globalData[RegistryKeys::CORE_CONFIG_DATA] = $this->getCoreConfigData();
1225
        $globalData[RegistryKeys::ENTITY_TYPES] = $eavEntityTypes = $this->getEavEntityTypes();
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