Passed
Push — 13.x ( fd9434...f6cd88 )
by Tim
09:26
created

loadEavAttributeOptionValueByAttributeCodeAndStoreIdAndValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 3
crap 2
1
<?php
2
3
/**
4
 * TechDivision\Import\Customer\Address\Services\CustomerAddressBunchProcessor
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 2018 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-customer-address
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Customer\Address\Services;
22
23
use TechDivision\Import\Actions\ActionInterface;
24
use TechDivision\Import\Connection\ConnectionInterface;
25
use TechDivision\Import\Repositories\EavAttributeRepositoryInterface;
26
use TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface;
27
use TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface;
28
use TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface;
29
use TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface;
30
use TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface;
31
32
/**
33
 * The customer address bunch processor implementation.
34
 *
35
 * @author    Tim Wagner <[email protected]>
36
 * @copyright 2018 TechDivision GmbH <[email protected]>
37
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
38
 * @link      https://github.com/techdivision/import-customer-address
39
 * @link      http://www.techdivision.com
40
 */
41
class CustomerAddressBunchProcessor implements CustomerAddressBunchProcessorInterface
42
{
43
44
    /**
45
     * A PDO connection initialized with the values from the Doctrine EntityManager.
46
     *
47
     * @var \TechDivision\Import\Connection\ConnectionInterface
48
     */
49
    protected $connection;
50
51
    /**
52
     * The repository to access EAV attribute option values.
53
     *
54
     * @var \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface
55
     */
56
    protected $eavAttributeOptionValueRepository;
57
58
    /**
59
     * The repository to access customer data.
60
     *
61
     * @var \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface
62
     */
63
    protected $customerRepository;
64
65
    /**
66
     * The repository to access customer address address data.
67
     *
68
     * @var \TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface
69
     */
70
    protected $customerAddressRepository;
71
72
    /**
73
     * The repository to access EAV attributes.
74
     *
75
     * @var \TechDivision\Import\Repositories\EavAttributeRepositoryInterface
76
     */
77
    protected $eavAttributeRepository;
78
79
    /**
80
     * The repository to access EAV attributes.
81
     *
82
     * @var \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface
83
     */
84
    protected $eavEntityTypeRepository;
85
86
    /**
87
     * The action for customer address CRUD methods.
88
     *
89
     * @var \TechDivision\Import\Actions\ActionInterface
90
     */
91
    protected $customerAddressAction;
92
93
    /**
94
     * The action for customer address varchar attribute CRUD methods.
95
     *
96
     * @var \TechDivision\Import\Actions\ActionInterface
97
     */
98
    protected $customerAddressVarcharAction;
99
100
    /**
101
     * The action for customer address text attribute CRUD methods.
102
     *
103
     * @var \TechDivision\Import\Actions\ActionInterface
104
     */
105
    protected $customerAddressTextAction;
106
107
    /**
108
     * The action for customer address int attribute CRUD methods.
109
     *
110
     * @var \TechDivision\Import\Actions\ActionInterface
111
     */
112
    protected $customerAddressIntAction;
113
114
    /**
115
     * The action for customer address decimal attribute CRUD methods.
116
     *
117
     * @var \\TechDivision\Import\Actions\ActionInterface
0 ignored issues
show
Bug introduced by
The type \TechDivision\Import\Actions\ActionInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
118
     */
119
    protected $customerAddressDecimalAction;
120
121
    /**
122
     * The action for customer address datetime attribute CRUD methods.
123
     *
124
     * @var \TechDivision\Import\Actions\ActionInterface
125
     */
126
    protected $customerAddressDatetimeAction;
127
128
    /**
129
     * The assembler to load the customer address attributes with.
130
     *
131
     * @var \TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface
132
     */
133
    protected $customerAddressAttributeAssembler;
134
135
    /**
136
     * Initialize the processor with the necessary assembler and repository instances.
137
     *
138
     * @param \TechDivision\Import\Connection\ConnectionInterface                                         $connection                        The connection to use
139
     * @param \TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface $customerAddressAttributeAssembler The customer address attribute assembler to use
140
     * @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface                $eavAttributeOptionValueRepository The EAV attribute option value repository to use
141
     * @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface                           $eavAttributeRepository            The EAV attribute repository to use
142
     * @param \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface                      $customerRepository                The customer repository to use
143
     * @param \TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface       $customerAddressRepository         The customer address repository to use
144
     * @param \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface                          $eavEntityTypeRepository           The EAV entity type repository to use
145
     * @param \TechDivision\Import\Actions\ActionInterface                                                $customerAddressAction             The customer address action to use
146
     * @param \TechDivision\Import\Actions\ActionInterface                                                $customerAddressDatetimeAction     The customer address datetime action to use
147
     * @param \TechDivision\Import\Actions\ActionInterface                                                $customerAddressDecimalAction      The customer address decimal action to use
148
     * @param \TechDivision\Import\Actions\ActionInterface                                                $customerAddressIntAction          The customer address integer action to use
149
     * @param \TechDivision\Import\Actions\ActionInterface                                                $customerAddressTextAction         The customer address text action to use
150
     * @param \TechDivision\Import\Actions\ActionInterface                                                $customerAddressVarcharAction      The customer address varchar action to use
151
     */
152
    public function __construct(
153
        ConnectionInterface $connection,
154
        CustomerAddressAttributeAssemblerInterface $customerAddressAttributeAssembler,
155
        EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository,
156
        EavAttributeRepositoryInterface $eavAttributeRepository,
157
        CustomerRepositoryInterface $customerRepository,
158
        CustomerAddressRepositoryInterface $customerAddressRepository,
159
        EavEntityTypeRepositoryInterface $eavEntityTypeRepository,
0 ignored issues
show
Unused Code introduced by
The parameter $eavEntityTypeRepository is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

159
        /** @scrutinizer ignore-unused */ EavEntityTypeRepositoryInterface $eavEntityTypeRepository,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
160
        ActionInterface $customerAddressAction,
161
        ActionInterface $customerAddressDatetimeAction,
162
        ActionInterface $customerAddressDecimalAction,
163
        ActionInterface $customerAddressIntAction,
164
        ActionInterface $customerAddressTextAction,
165
        ActionInterface $customerAddressVarcharAction
166
    ) {
167
        $this->setConnection($connection);
168
        $this->setCustomerAddressAttributeAssembler($customerAddressAttributeAssembler);
169
        $this->setEavAttributeOptionValueRepository($eavAttributeOptionValueRepository);
170
        $this->setEavAttributeRepository($eavAttributeRepository);
171
        $this->setCustomerRepository($customerRepository);
172
        $this->setCustomerAddressRepository($customerAddressRepository);
173
        $this->setCustomerAddressAction($customerAddressAction);
174
        $this->setCustomerAddressDatetimeAction($customerAddressDatetimeAction);
175
        $this->setCustomerAddressDecimalAction($customerAddressDecimalAction);
176
        $this->setCustomerAddressIntAction($customerAddressIntAction);
177
        $this->setCustomerAddressTextAction($customerAddressTextAction);
178
        $this->setCustomerAddressVarcharAction($customerAddressVarcharAction);
179
    }
180
181
    /**
182
     * Set's the passed connection.
183
     *
184
     * @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection to set
185
     *
186
     * @return void
187
     */
188
    public function setConnection(ConnectionInterface $connection)
189
    {
190
        $this->connection = $connection;
191
    }
192
193
    /**
194
     * Return's the connection.
195
     *
196
     * @return \TechDivision\Import\Connection\ConnectionInterface The connection instance
197
     */
198
    public function getConnection()
199
    {
200
        return $this->connection;
201
    }
202
203
    /**
204
     * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO
205
     * object instance are not committed until you end the transaction by calling CustomerProcessor::commit().
206
     * Calling CustomerProcessor::rollBack() will roll back all changes to the database and return the connection
207
     * to autocommit mode.
208
     *
209
     * @return boolean Returns TRUE on success or FALSE on failure
210
     * @link http://php.net/manual/en/pdo.begintransaction.php
211
     */
212
    public function beginTransaction()
213
    {
214
        return $this->connection->beginTransaction();
215
    }
216
217
    /**
218
     * Commits a transaction, returning the database connection to autocommit mode until the next call to
219
     * CustomerProcessor::beginTransaction() starts a new transaction.
220
     *
221
     * @return boolean Returns TRUE on success or FALSE on failure
222
     * @link http://php.net/manual/en/pdo.commit.php
223
     */
224
    public function commit()
225
    {
226
        return $this->connection->commit();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->connection->commit() returns the type void which is incompatible with the documented return type boolean.
Loading history...
Bug introduced by
Are you sure the usage of $this->connection->commit() targeting TechDivision\Import\Conn...tionInterface::commit() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
227
    }
228
229
    /**
230
     * Rolls back the current transaction, as initiated by CustomerProcessor::beginTransaction().
231
     *
232
     * If the database was set to autocommit mode, this function will restore autocommit mode after it has
233
     * rolled back the transaction.
234
     *
235
     * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition
236
     * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit
237
     * COMMIT will prevent you from rolling back any other changes within the transaction boundary.
238
     *
239
     * @return boolean Returns TRUE on success or FALSE on failure
240
     * @link http://php.net/manual/en/pdo.rollback.php
241
     */
242
    public function rollBack()
243
    {
244
        return $this->connection->rollBack();
245
    }
246
247
    /**
248
     * Set's the repository to load the customers with.
249
     *
250
     * @param \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface $customerRepository The repository instance
251
     *
252
     * @return void
253
     */
254
    public function setCustomerRepository(CustomerRepositoryInterface $customerRepository)
255
    {
256
        $this->customerRepository = $customerRepository;
257
    }
258
259
    /**
260
     * Return's the repository to load the customers with.
261
     *
262
     * @return \TechDivision\Import\Customer\Repositories\CustomerRepositoryInterface The repository instance
263
     */
264
    public function getCustomerRepository()
265
    {
266
        return $this->customerRepository;
267
    }
268
269
    /**
270
     * Set's the repository to load the customer addresses with.
271
     *
272
     * @param \TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface $customerAddressRepository The repository instance
273
     *
274
     * @return void
275
     */
276
    public function setCustomerAddressRepository(CustomerAddressRepositoryInterface $customerAddressRepository)
277
    {
278
        $this->customerAddressRepository = $customerAddressRepository;
279
    }
280
281
    /**
282
     * Return's the repository to load the customer addresses with.
283
     *
284
     * @return \TechDivision\Import\Customer\Address\Repositories\CustomerAddressRepositoryInterface The repository instance
285
     */
286
    public function getCustomerAddressRepository()
287
    {
288
        return $this->customerAddressRepository;
289
    }
290
291
    /**
292
     * Set's the action with the customer address CRUD methods.
293
     *
294
     * @param \TechDivision\Import\Actions\ActionInterface $customerAddressAction The action with the customer CRUD methods
295
     *
296
     * @return void
297
     */
298
    public function setCustomerAddressAction(ActionInterface $customerAddressAction)
299
    {
300
        $this->customerAddressAction = $customerAddressAction;
301
    }
302
303
    /**
304
     * Return's the action with the customer address CRUD methods.
305
     *
306
     * @return \TechDivision\Import\Actions\ActionInterface The action instance
307
     */
308
    public function getCustomerAddressAction()
309
    {
310
        return $this->customerAddressAction;
311
    }
312
313
    /**
314
     * Set's the action with the customer address varchar attribute CRUD methods.
315
     *
316
     * @param \TechDivision\Import\Actions\ActionInterface $customerAddressVarcharAction The action with the customer varchar attriute CRUD methods
317
     *
318
     * @return void
319
     */
320
    public function setCustomerAddressVarcharAction(ActionInterface $customerAddressVarcharAction)
321
    {
322
        $this->customerAddressVarcharAction = $customerAddressVarcharAction;
323
    }
324
325
    /**
326
     * Return's the action with the customer address varchar attribute CRUD methods.
327
     *
328
     * @return \TechDivision\Import\Actions\ActionInterface The action instance
329
     */
330
    public function getCustomerAddressVarcharAction()
331
    {
332
        return $this->customerAddressVarcharAction;
333
    }
334
335
    /**
336
     * Set's the action with the customer address text attribute CRUD methods.
337
     *
338
     * @param \TechDivision\Import\Actions\ActionInterface $customerAddressTextAction The action with the customer text attriute CRUD methods
339
     *
340
     * @return void
341
     */
342
    public function setCustomerAddressTextAction(ActionInterface $customerAddressTextAction)
343
    {
344
        $this->customerAddressTextAction = $customerAddressTextAction;
345
    }
346
347
    /**
348
     * Return's the action with the customer address text attribute CRUD methods.
349
     *
350
     * @return \TechDivision\Import\Actions\ActionInterface The action instance
351
     */
352
    public function getCustomerAddressTextAction()
353
    {
354
        return $this->customerAddressTextAction;
355
    }
356
357
    /**
358
     * Set's the action with the customer address int attribute CRUD methods.
359
     *
360
     * @param \TechDivision\Import\Actions\ActionInterface $customerAddressIntAction The action with the customer int attriute CRUD methods
361
     *
362
     * @return void
363
     */
364
    public function setCustomerAddressIntAction(ActionInterface $customerAddressIntAction)
365
    {
366
        $this->customerAddressIntAction = $customerAddressIntAction;
367
    }
368
369
    /**
370
     * Return's the action with the customer address int attribute CRUD methods.
371
     *
372
     * @return \TechDivision\Import\Actions\ActionInterface The action instance
373
     */
374
    public function getCustomerAddressIntAction()
375
    {
376
        return $this->customerAddressIntAction;
377
    }
378
379
    /**
380
     * Set's the action with the customer address decimal attribute CRUD methods.
381
     *
382
     * @param \TechDivision\Import\Actions\ActionInterface $customerAddressDecimalAction The action with the customer decimal attriute CRUD methods
383
     *
384
     * @return void
385
     */
386
    public function setCustomerAddressDecimalAction(ActionInterface $customerAddressDecimalAction)
387
    {
388
        $this->customerAddressDecimalAction = $customerAddressDecimalAction;
0 ignored issues
show
Documentation Bug introduced by
It seems like $customerAddressDecimalAction of type TechDivision\Import\Actions\ActionInterface is incompatible with the declared type \TechDivision\Import\Actions\ActionInterface of property $customerAddressDecimalAction.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
389
    }
390
391
    /**
392
     * Return's the action with the customer address decimal attribute CRUD methods.
393
     *
394
     * @return \TechDivision\Import\Actions\ActionInterface The action instance
395
     */
396
    public function getCustomerAddressDecimalAction()
397
    {
398
        return $this->customerAddressDecimalAction;
399
    }
400
401
    /**
402
     * Set's the action with the customer address datetime attribute CRUD methods.
403
     *
404
     * @param \TechDivision\Import\Actions\ActionInterface $customerAddressDatetimeAction The action with the customer datetime attriute CRUD methods
405
     *
406
     * @return void
407
     */
408
    public function setCustomerAddressDatetimeAction(ActionInterface $customerAddressDatetimeAction)
409
    {
410
        $this->customerAddressDatetimeAction = $customerAddressDatetimeAction;
411
    }
412
413
    /**
414
     * Return's the action with the customer address datetime attribute CRUD methods.
415
     *
416
     * @return \TechDivision\Import\Actions\ActionInterface The action instance
417
     */
418
    public function getCustomerAddressDatetimeAction()
419
    {
420
        return $this->customerAddressDatetimeAction;
421
    }
422
423
    /**
424
     * Set's the repository to access EAV attribute option values.
425
     *
426
     * @param \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository The repository to access EAV attribute option values
427
     *
428
     * @return void
429
     */
430
    public function setEavAttributeOptionValueRepository(EavAttributeOptionValueRepositoryInterface $eavAttributeOptionValueRepository)
431
    {
432
        $this->eavAttributeOptionValueRepository = $eavAttributeOptionValueRepository;
433
    }
434
435
    /**
436
     * Return's the repository to access EAV attribute option values.
437
     *
438
     * @return \TechDivision\Import\Repositories\EavAttributeOptionValueRepositoryInterface The repository instance
439
     */
440
    public function getEavAttributeOptionValueRepository()
441
    {
442
        return $this->eavAttributeOptionValueRepository;
443
    }
444
445
    /**
446
     * Set's the repository to access EAV attributes.
447
     *
448
     * @param \TechDivision\Import\Repositories\EavAttributeRepositoryInterface $eavAttributeRepository The repository to access EAV attributes
449
     *
450
     * @return void
451
     */
452
    public function setEavAttributeRepository(EavAttributeRepositoryInterface $eavAttributeRepository)
453
    {
454
        $this->eavAttributeRepository = $eavAttributeRepository;
455
    }
456
457
    /**
458
     * Return's the repository to access EAV attributes.
459
     *
460
     * @return \TechDivision\Import\Repositories\EavAttributeRepositoryInterface The repository instance
461
     */
462
    public function getEavAttributeRepository()
463
    {
464
        return $this->eavAttributeRepository;
465
    }
466
467
    /**
468
     * Set's the repository to access EAV entity types.
469
     *
470
     * @param \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface $eavEntityTypeRepository The repository to access EAV entity types
471
     *
472
     * @return void
473
     */
474
    public function setEavEntityTypeRepository(EavEntityTypeRepositoryInterface $eavEntityTypeRepository)
475
    {
476
        $this->eavEntityTypeRepository = $eavEntityTypeRepository;
477
    }
478
479
    /**
480
     * Return's the repository to access EAV entity types.
481
     *
482
     * @return \TechDivision\Import\Repositories\EavEntityTypeRepositoryInterface The repository instance
483
     */
484
    public function getEavEntityTypeRepository()
485
    {
486
        return $this->eavAttributeRepository;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->eavAttributeRepository returns the type TechDivision\Import\Repo...buteRepositoryInterface which is incompatible with the documented return type TechDivision\Import\Repo...TypeRepositoryInterface.
Loading history...
487
    }
488
489
    /**
490
     * Set's the assembler to load the customer address attributes with.
491
     *
492
     * @param \TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface $customerAddressAttributeAssembler The assembler instance
493
     *
494
     * @return void
495
     */
496
    public function setCustomerAddressAttributeAssembler(CustomerAddressAttributeAssemblerInterface $customerAddressAttributeAssembler)
497
    {
498
        $this->customerAddressAttributeAssembler = $customerAddressAttributeAssembler;
499
    }
500
501
    /**
502
     * Return's the assembler to load the customer address attributes with.
503
     *
504
     * @return \TechDivision\Import\Customer\Address\Assemblers\CustomerAddressAttributeAssemblerInterface The assembler instance
505
     */
506
    public function getCustomerAddressAttributeAssembler()
507
    {
508
        return $this->customerAddressAttributeAssembler;
509
    }
510
511
    /**
512
     * Return's an array with the available EAV attributes for the passed is user defined flag.
513
     *
514
     * @param integer $isUserDefined The flag itself
515
     *
516
     * @return array The array with the EAV attributes matching the passed flag
517
     */
518
    public function getEavAttributeByIsUserDefined($isUserDefined = 1)
519
    {
520
        return $this->getEavAttributeRepository()->findAllByIsUserDefined($isUserDefined);
521
    }
522
523
    /**
524
     * Intializes the existing attributes for the entity with the passed entity ID.
525
     *
526
     * @param integer $entityId The entity ID of the entity to load the attributes for
527
     *
528
     * @return array The entity attributes
529
     */
530
    public function getCustomerAddressAttributesByEntityId($entityId)
531
    {
532
        return $this->getCustomerAddressAttributeAssembler()->getCustomerAddressAttributesByEntityId($entityId);
533
    }
534
535
    /**
536
     * Load's and return's the EAV attribute option value with the passed entity type ID, code, store ID and value.
537
     *
538
     * @param string  $entityTypeId  The entity type ID of the EAV attribute to load the option value for
539
     * @param string  $attributeCode The code of the EAV attribute option to load
540
     * @param integer $storeId       The store ID of the attribute option to load
541
     * @param string  $value         The value of the attribute option to load
542
     *
543
     * @return array The EAV attribute option value
544
     */
545
    public function loadAttributeOptionValueByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($entityTypeId, $attributeCode, $storeId, $value)
546
    {
547
        return $this->getEavAttributeOptionValueRepository()->findOneByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($entityTypeId, $attributeCode, $storeId, $value);
548
    }
549
550
    /**
551
     * Return's an EAV entity type with the passed entity type code.
552
     *
553
     * @param string $entityTypeCode The code of the entity type to return
554
     *
555
     * @return array The entity type with the passed entity type code
556
     */
557
    public function loadEavEntityTypeByEntityTypeCode($entityTypeCode)
558
    {
559
        return $this->getEavEntityTypeRepository()->findOneByEntityTypeCode($entityTypeCode);
560
    }
561
562
    /**
563
     * Return's the customer with the passed entity ID.
564
     *
565
     * @param integer $id The entity ID of the customer to return
566
     *
567
     * @return array|null The customer
568
     */
569
    public function loadCustomerAddress($id)
570
    {
571
        return $this->getCustomerAddressRepository()->load($id);
572
    }
573
574
    /**
575
     * Return's the customer with the passed email and website ID.
576
     *
577
     * @param string $email     The email of the customer to return
578
     * @param string $websiteId The website ID of the customer to return
579
     *
580
     * @return array|null The customer
581
     */
582
    public function loadCustomerByEmailAndWebsiteId($email, $websiteId)
583
    {
584
        return $this->getCustomerRepository()->findOneByEmailAndWebsiteId($email, $websiteId);
585
    }
586
587
    /**
588
     * Persist's the passed customer address data and return's the ID.
589
     *
590
     * @param array       $customerAddress The customer data to persist
591
     * @param string|null $name            The name of the prepared statement that has to be executed
592
     *
593
     * @return string The ID of the persisted entity
594
     */
595
    public function persistCustomerAddress($customerAddress, $name = null)
596
    {
597
        return $this->getCustomerAddressAction()->persist($customerAddress, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Acti...ionInterface::persist() has too many arguments starting with $name. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

597
        return $this->getCustomerAddressAction()->/** @scrutinizer ignore-call */ persist($customerAddress, $name);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
Bug Best Practice introduced by
The expression return $this->getCustome...customerAddress, $name) returns the type void which is incompatible with the documented return type string.
Loading history...
Bug introduced by
Are you sure the usage of $this->getCustomerAddres...customerAddress, $name) targeting TechDivision\Import\Acti...ionInterface::persist() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
598
    }
599
600
    /**
601
     * Persist's the passed customer address varchar attribute.
602
     *
603
     * @param array       $attribute The attribute to persist
604
     * @param string|null $name      The name of the prepared statement that has to be executed
605
     *
606
     * @return void
607
     */
608
    public function persistCustomerAddressVarcharAttribute($attribute, $name = null)
609
    {
610
        $this->getCustomerAddressVarcharAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Acti...ionInterface::persist() has too many arguments starting with $name. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

610
        $this->getCustomerAddressVarcharAction()->/** @scrutinizer ignore-call */ persist($attribute, $name);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
611
    }
612
613
    /**
614
     * Persist's the passed customer address integer attribute.
615
     *
616
     * @param array       $attribute The attribute to persist
617
     * @param string|null $name      The name of the prepared statement that has to be executed
618
     *
619
     * @return void
620
     */
621
    public function persistCustomerAddressIntAttribute($attribute, $name = null)
622
    {
623
        $this->getCustomerAddressIntAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Acti...ionInterface::persist() has too many arguments starting with $name. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

623
        $this->getCustomerAddressIntAction()->/** @scrutinizer ignore-call */ persist($attribute, $name);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
624
    }
625
626
    /**
627
     * Persist's the passed customer address decimal attribute.
628
     *
629
     * @param array       $attribute The attribute to persist
630
     * @param string|null $name      The name of the prepared statement that has to be executed
631
     *
632
     * @return void
633
     */
634
    public function persistCustomerAddressDecimalAttribute($attribute, $name = null)
635
    {
636
        $this->getCustomerAddressDecimalAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Acti...ionInterface::persist() has too many arguments starting with $name. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

636
        $this->getCustomerAddressDecimalAction()->/** @scrutinizer ignore-call */ persist($attribute, $name);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
637
    }
638
639
    /**
640
     * Persist's the passed customer address datetime attribute.
641
     *
642
     * @param array       $attribute The attribute to persist
643
     * @param string|null $name      The name of the prepared statement that has to be executed
644
     *
645
     * @return void
646
     */
647
    public function persistCustomerAddressDatetimeAttribute($attribute, $name = null)
648
    {
649
        $this->getCustomerAddressDatetimeAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Acti...ionInterface::persist() has too many arguments starting with $name. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

649
        $this->getCustomerAddressDatetimeAction()->/** @scrutinizer ignore-call */ persist($attribute, $name);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
650
    }
651
652
    /**
653
     * Persist's the passed customer address text attribute.
654
     *
655
     * @param array       $attribute The attribute to persist
656
     * @param string|null $name      The name of the prepared statement that has to be executed
657
     *
658
     * @return void
659
     */
660
    public function persistCustomerAddressTextAttribute($attribute, $name = null)
661
    {
662
        $this->getCustomerAddressTextAction()->persist($attribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to TechDivision\Import\Acti...ionInterface::persist() has too many arguments starting with $name. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

662
        $this->getCustomerAddressTextAction()->/** @scrutinizer ignore-call */ persist($attribute, $name);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
663
    }
664
665
    /**
666
     * Delete's the entity with the passed attributes.
667
     *
668
     * @param array       $row  The attributes of the entity to delete
669
     * @param string|null $name The name of the prepared statement that has to be executed
670
     *
671
     * @return void
672
     */
673
    public function deleteCustomerAddress($row, $name = null)
674
    {
675
        $this->getCustomerAddressAction()->delete($row, $name);
676
    }
677
678
    /**
679
     * Delete's the customer address datetime attribute with the passed attributes.
680
     *
681
     * @param array       $row  The attributes of the entity to delete
682
     * @param string|null $name The name of the prepared statement that has to be executed
683
     *
684
     * @return void
685
     */
686
    public function deleteCustomerAddressDatetimeAttribute($row, $name = null)
687
    {
688
        $this->getCustomerAddressDatetimeAction()->delete($row, $name);
689
    }
690
691
    /**
692
     * Delete's the customer address decimal attribute with the passed attributes.
693
     *
694
     * @param array       $row  The attributes of the entity to delete
695
     * @param string|null $name The name of the prepared statement that has to be executed
696
     *
697
     * @return void
698
     */
699
    public function deleteCustomerAddressDecimalAttribute($row, $name = null)
700
    {
701
        $this->getCustomerAddressDecimalAction()->delete($row, $name);
702
    }
703
704
    /**
705
     * Delete's the customer address integer attribute with the passed attributes.
706
     *
707
     * @param array       $row  The attributes of the entity to delete
708
     * @param string|null $name The name of the prepared statement that has to be executed
709
     *
710
     * @return void
711
     */
712
    public function deleteCustomerAddressIntAttribute($row, $name = null)
713
    {
714
        $this->getCustomerAddressIntAction()->delete($row, $name);
715
    }
716
717
    /**
718
     * Delete's the customer address text attribute with the passed attributes.
719
     *
720
     * @param array       $row  The attributes of the entity to delete
721
     * @param string|null $name The name of the prepared statement that has to be executed
722
     *
723
     * @return void
724
     */
725
    public function deleteCustomerAddressTextAttribute($row, $name = null)
726
    {
727
        $this->getCustomerAddressTextAction()->delete($row, $name);
728
    }
729
730
    /**
731
     * Delete's the customer address varchar attribute with the passed attributes.
732
     *
733
     * @param array       $row  The attributes of the entity to delete
734
     * @param string|null $name The name of the prepared statement that has to be executed
735
     *
736
     * @return void
737
     */
738
    public function deleteCustomerAddressVarcharAttribute($row, $name = null)
739
    {
740
        $this->getCustomerAddressVarcharAction()->delete($row, $name);
741
    }
742
743
    /**
744
     * Clean-Up the repositories to free memory.
745
     *
746
     * @return void
747
     */
748
    public function cleanUp()
749
    {
750
        // flush the cache
751
    }
752
}
753