Completed
Push — master ( 8142ec...e2d21b )
by Tim
11s
created

ProductVariantProcessor::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 25
ccs 0
cts 25
cp 0
rs 8.8571
cc 1
eloc 23
nc 1
nop 11
crap 2

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
/**
4
 * TechDivision\Import\Product\Variant\Services\ProductVariantProcessor
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-product-variant
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Product\Variant\Services;
22
23
use TechDivision\Import\Repositories\EavAttributeOptionValueRepository;
24
use TechDivision\Import\Repositories\EavAttributeRepository;
25
use TechDivision\Import\Product\Variant\Repositories\ProductRelationRepository;
26
use TechDivision\Import\Product\Variant\Repositories\ProductSuperLinkRepository;
27
use TechDivision\Import\Product\Variant\Repositories\ProductSuperAttributeRepository;
28
use TechDivision\Import\Product\Variant\Repositories\ProductSuperAttributeLabelRepository;
29
use TechDivision\Import\Product\Variant\Actions\ProductRelationAction;
30
use TechDivision\Import\Product\Variant\Actions\ProductSuperLinkAction;
31
use TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeAction;
32
use TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeLabelAction;
33
34
/**
35
 * A SLSB providing methods to load product data using a PDO connection.
36
 *
37
 * @author    Tim Wagner <[email protected]>
38
 * @copyright 2016 TechDivision GmbH <[email protected]>
39
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
40
 * @link      https://github.com/techdivision/import-product-variant
41
 * @link      http://www.techdivision.com
42
 */
43
class ProductVariantProcessor implements ProductVariantProcessorInterface
44
{
45
46
    /**
47
     * A PDO connection initialized with the values from the Doctrine EntityManager.
48
     *
49
     * @var \PDO
50
     */
51
    protected $connection;
52
53
    /**
54
     * The repository to access product relations.
55
     *
56
     * @var \TechDivision\Import\Product\Repositories\ProductRelationRepository
57
     */
58
    protected $productRelationRepository;
59
60
    /**
61
     * The repository to access product relations.
62
     *
63
     * @var \TechDivision\Import\Product\Repositories\ProductSuperLinkRepository
64
     */
65
    protected $productSuperLinkRepository;
66
67
    /**
68
     * The repository to access product super attributes.
69
     *
70
     * @var \TechDivision\Import\Product\Repositories\ProductSuperAttributeRepository
71
     */
72
    protected $productSuperAttributeRepository;
73
74
    /**
75
     * The repository to access product super attribute labels.
76
     *
77
     * @var \TechDivision\Import\Product\Repositories\ProductSuperAttributeLabelRepository
78
     */
79
    protected $productSuperAttributeLabelRepository;
80
81
    /**
82
     * The repository to access EAV attributes.
83
     *
84
     * @var \TechDivision\Import\Product\Repositories\EavAttributeRepository
85
     */
86
    protected $eavAttributeRepository;
87
88
    /**
89
     * The repository to access EAV attribute option values.
90
     *
91
     * @var \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository
92
     */
93
    protected $eavAttributeOptionValueRepository;
94
95
    /**
96
     * The action for product relation CRUD methods.
97
     *
98
     * @var \TechDivision\Import\Product\Variant\Actions\ProductRelationAction
99
     */
100
    protected $productRelationAction;
101
102
    /**
103
     * The action for product super attribute CRUD methods.
104
     *
105
     * @var \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeAction
106
     */
107
    protected $productSuperAttributeAction;
108
109
    /**
110
     * The action for product super attribute label CRUD methods.
111
     *
112
     * @var \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeLabelAction
113
     */
114
    protected $productSuperAttributeLabelAction;
115
116
    /**
117
     * The action for product super link CRUD methods.
118
     *
119
     * @var \TechDivision\Import\Product\Variant\Actions\ProductSuperLinkAction
120
     */
121
    protected $productSuperLinkAction;
122
123
    /**
124
     * Initialize the processor with the necessary assembler and repository instances.
125
     *
126
     * @param \PDO                                                                           $connection                           The PDO connection to use
127
     * @param \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository    $eavAttributeOptionValueRepository    The EAV attribute option value repository to use
128
     * @param \TechDivision\Import\Product\Repositories\EavAttributeRepository               $eavAttributeRepository               The EAV attribute repository to use
129
     * @param \TechDivision\Import\Product\Repositories\ProductRelationRepository            $productRelationRepository            The product relation repository to use
130
     * @param \TechDivision\Import\Product\Repositories\ProductSuperLinkRepository           $productSuperLinkRepository           The product super link repository to use
131
     * @param \TechDivision\Import\Product\Repositories\ProductSuperAttributeRepository      $productSuperAttributeRepository      The product super attribute repository to use
132
     * @param \TechDivision\Import\Product\Repositories\ProductSuperAttributeLabelRepository $productSuperAttributeLabelRepository The product super attribute label repository to use
133
     * @param \TechDivision\Import\Product\Variant\Actions\ProductRelationAction             $productRelationAction                The product relation action to use
134
     * @param \TechDivision\Import\Product\Variant\Actions\ProductSuperLinkAction            $productSuperLinkAction               The product super link action to use
135
     * @param \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeAction       $productSuperAttributeAction          The product super attribute action to use
136
     * @param \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeLabelAction  $productSuperAttributeLabelAction     The product super attribute label action to use
137
     */
138
    public function __construct(
139
        \PDO $connection,
140
        EavAttributeOptionValueRepository $eavAttributeOptionValueRepository,
141
        EavAttributeRepository $eavAttributeRepository,
142
        ProductRelationRepository $productRelationRepository,
143
        ProductSuperLinkRepository $productSuperLinkRepository,
144
        ProductSuperAttributeRepository $productSuperAttributeRepository,
145
        ProductSuperAttributeLabelRepository $productSuperAttributeLabelRepository,
146
        ProductRelationAction $productRelationAction,
147
        ProductSuperLinkAction $productSuperLinkAction,
148
        ProductSuperAttributeAction $productSuperAttributeAction,
149
        ProductSuperAttributeLabelAction $productSuperAttributeLabelAction
150
    ) {
151
        $this->setConnection($connection);
152
        $this->setEavAttributeOptionValueRepository($eavAttributeOptionValueRepository);
0 ignored issues
show
Documentation introduced by
$eavAttributeOptionValueRepository is of type object<TechDivision\Impo...eOptionValueRepository>, but the function expects a object<TechDivision\Impo...eOptionValueRepository>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
153
        $this->setEavAttributeRepository($eavAttributeRepository);
0 ignored issues
show
Documentation introduced by
$eavAttributeRepository is of type object<TechDivision\Impo...EavAttributeRepository>, but the function expects a object<TechDivision\Impo...EavAttributeRepository>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
154
        $this->setProductRelationRepository($productRelationRepository);
0 ignored issues
show
Documentation introduced by
$productRelationRepository is of type object<TechDivision\Impo...ductRelationRepository>, but the function expects a object<TechDivision\Impo...ductRelationRepository>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
155
        $this->setProductSuperLinkRepository($productSuperLinkRepository);
0 ignored issues
show
Documentation introduced by
$productSuperLinkRepository is of type object<TechDivision\Impo...uctSuperLinkRepository>, but the function expects a object<TechDivision\Impo...uctSuperLinkRepository>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
156
        $this->setProductSuperAttributeRepository($productSuperAttributeRepository);
0 ignored issues
show
Documentation introduced by
$productSuperAttributeRepository is of type object<TechDivision\Impo...perAttributeRepository>, but the function expects a object<TechDivision\Impo...perAttributeRepository>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
157
        $this->setProductSuperAttributeLabelRepository($productSuperAttributeLabelRepository);
0 ignored issues
show
Documentation introduced by
$productSuperAttributeLabelRepository is of type object<TechDivision\Impo...tributeLabelRepository>, but the function expects a object<TechDivision\Impo...tributeLabelRepository>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
158
        $this->setProductRelationAction($productRelationAction);
159
        $this->setProductSuperLinkAction($productSuperLinkAction);
160
        $this->setProductSuperAttributeAction($productSuperAttributeAction);
161
        $this->setProductSuperAttributeLabelAction($productSuperAttributeLabelAction);
162
    }
163
164
    /**
165
     * Set's the passed connection.
166
     *
167
     * @param \PDO $connection The connection to set
168
     *
169
     * @return void
170
     */
171
    public function setConnection(\PDO $connection)
172
    {
173
        $this->connection = $connection;
174
    }
175
176
    /**
177
     * Return's the connection.
178
     *
179
     * @return \PDO The connection instance
180
     */
181
    public function getConnection()
182
    {
183
        return $this->connection;
184
    }
185
186
    /**
187
     * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO
188
     * object instance are not committed until you end the transaction by calling ProductProcessor::commit().
189
     * Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection
190
     * to autocommit mode.
191
     *
192
     * @return boolean Returns TRUE on success or FALSE on failure
193
     * @link http://php.net/manual/en/pdo.begintransaction.php
194
     */
195
    public function beginTransaction()
196
    {
197
        return $this->connection->beginTransaction();
198
    }
199
200
    /**
201
     * Commits a transaction, returning the database connection to autocommit mode until the next call to
202
     * ProductProcessor::beginTransaction() starts a new transaction.
203
     *
204
     * @return boolean Returns TRUE on success or FALSE on failure
205
     * @link http://php.net/manual/en/pdo.commit.php
206
     */
207
    public function commit()
208
    {
209
        return $this->connection->commit();
210
    }
211
212
    /**
213
     * Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction().
214
     *
215
     * If the database was set to autocommit mode, this function will restore autocommit mode after it has
216
     * rolled back the transaction.
217
     *
218
     * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition
219
     * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit
220
     * COMMIT will prevent you from rolling back any other changes within the transaction boundary.
221
     *
222
     * @return boolean Returns TRUE on success or FALSE on failure
223
     * @link http://php.net/manual/en/pdo.rollback.php
224
     */
225
    public function rollBack()
226
    {
227
        return $this->connection->rollBack();
228
    }
229
230
    /**
231
     * Set's the repository to access EAV attributes.
232
     *
233
     * @param \TechDivision\Import\Product\Repositories\EavAttributeRepository $eavAttributeRepository The repository to access EAV attributes
234
     *
235
     * @return void
236
     */
237
    public function setEavAttributeRepository($eavAttributeRepository)
238
    {
239
        $this->eavAttributeRepository = $eavAttributeRepository;
240
    }
241
242
    /**
243
     * Return's the repository to access EAV attributes.
244
     *
245
     * @return \TechDivision\Import\Product\Repositories\EavAttributeRepository The repository instance
246
     */
247
    public function getEavAttributeRepository()
248
    {
249
        return $this->eavAttributeRepository;
250
    }
251
252
    /**
253
     * Set's the repository to access product relations.
254
     *
255
     * @param \TechDivision\Import\Product\Repositories\ProductRelationRepository $productRelationRepository The repository instance
256
     *
257
     * @return void
258
     */
259
    public function setProductRelationRepository($productRelationRepository)
260
    {
261
        $this->productRelationRepository = $productRelationRepository;
262
    }
263
264
    /**
265
     * Return's the repository to access product relations.
266
     *
267
     * @return \TechDivision\Import\Product\Repositories\ProductRelationRepository The repository instance
268
     */
269
    public function getProductRelationRepository()
270
    {
271
        return $this->productRelationRepository;
272
    }
273
274
    /**
275
     * Set's the repository to access product super links.
276
     *
277
     * @param \TechDivision\Import\Product\Repositories\ProductSuperLinkRepository $productSuperLinkRepository The repository instance
278
     *
279
     * @return void
280
     */
281
    public function setProductSuperLinkRepository($productSuperLinkRepository)
282
    {
283
        $this->productSuperLinkRepository = $productSuperLinkRepository;
284
    }
285
286
    /**
287
     * Return's the repository to access product super links.
288
     *
289
     * @return \TechDivision\Import\Product\Repositories\ProductSuperLinkRepository The repository instance
290
     */
291
    public function getProductSuperLinkRepository()
292
    {
293
        return $this->productSuperLinkRepository;
294
    }
295
296
    /**
297
     * Set's the repository to access product super attributes.
298
     *
299
     * @param \TechDivision\Import\Product\Repositories\ProductSuperAttributeRepository $productSuperAttributeRepository The repository instance
300
     *
301
     * @return void
302
     */
303
    public function setProductSuperAttributeRepository($productSuperAttributeRepository)
304
    {
305
        $this->productSuperAttributeRepository = $productSuperAttributeRepository;
306
    }
307
308
    /**
309
     * Return's the repository to access product super attributes.
310
     *
311
     * @return \TechDivision\Import\Product\Repositories\ProductSuperAttributeRepository The repository instance
312
     */
313
    public function getProductSuperAttributeRepository()
314
    {
315
        return $this->productSuperAttributeRepository;
316
    }
317
318
    /**
319
     * Set's the repository to access product super attribute labels.
320
     *
321
     * @param \TechDivision\Import\Product\Repositories\ProductSuperAttributeLabelRepository $productSuperAttributeLabelRepository The repository instance
322
     *
323
     * @return void
324
     */
325
    public function setProductSuperAttributeLabelRepository($productSuperAttributeLabelRepository)
326
    {
327
        $this->productSuperAttributeLabelRepository = $productSuperAttributeLabelRepository;
328
    }
329
330
    /**
331
     * Return's the repository to access product super attribute labels.
332
     *
333
     * @return \TechDivision\Import\Product\Repositories\ProductSuperAttributLabeleRepository The repository instance
334
     */
335
    public function getProductSuperAttributeLabelRepository()
336
    {
337
        return $this->productSuperAttributeLabelRepository;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->productSup...tributeLabelRepository; (TechDivision\Import\Prod...ttributeLabelRepository) is incompatible with the return type declared by the interface TechDivision\Import\Prod...ttributeLabelRepository of type TechDivision\Import\Prod...ttributLabeleRepository.

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

Let’s take a look at an example:

class Author {
    private $name;

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

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

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

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

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

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

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

Loading history...
338
    }
339
340
    /**
341
     * Set's the repository to access EAV attribute option values.
342
     *
343
     * @param \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository $eavAttributeOptionValueRepository The repository to access EAV attribute option values
344
     *
345
     * @return void
346
     */
347
    public function setEavAttributeOptionValueRepository($eavAttributeOptionValueRepository)
348
    {
349
        $this->eavAttributeOptionValueRepository = $eavAttributeOptionValueRepository;
350
    }
351
352
    /**
353
     * Return's the repository to access EAV attribute option values.
354
     *
355
     * @return \TechDivision\Import\Product\Repositories\EavAttributeOptionValueRepository The repository instance
356
     */
357
    public function getEavAttributeOptionValueRepository()
358
    {
359
        return $this->eavAttributeOptionValueRepository;
360
    }
361
362
    /**
363
     * Set's the action with the product relation CRUD methods.
364
     *
365
     * @param \TechDivision\Import\Product\Variant\Actions\ProductRelationAction $productRelationAction The action with the product relation CRUD methods
366
     *
367
     * @return void
368
     */
369
    public function setProductRelationAction($productRelationAction)
370
    {
371
        $this->productRelationAction = $productRelationAction;
372
    }
373
374
    /**
375
     * Return's the action with the product relation CRUD methods.
376
     *
377
     * @return \TechDivision\Import\Product\Variant\Actions\ProductRelationAction The action instance
378
     */
379
    public function getProductRelationAction()
380
    {
381
        return $this->productRelationAction;
382
    }
383
384
    /**
385
     * Set's the action with the product super attribute CRUD methods.
386
     *
387
     * @param \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeAction $productSuperAttributeAction The action with the product super attribute CRUD methods
388
     *
389
     * @return void
390
     */
391
    public function setProductSuperAttributeAction($productSuperAttributeAction)
392
    {
393
        $this->productSuperAttributeAction = $productSuperAttributeAction;
394
    }
395
396
    /**
397
     * Return's the action with the product super attribute CRUD methods.
398
     *
399
     * @return \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeAction The action instance
400
     */
401
    public function getProductSuperAttributeAction()
402
    {
403
        return $this->productSuperAttributeAction;
404
    }
405
406
    /**
407
     * Set's the action with the product super attribute label CRUD methods.
408
     *
409
     * @param \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeLabelAction $productSuperAttributeLabelAction The action with the product super attribute label CRUD methods
410
     *
411
     * @return void
412
     */
413
    public function setProductSuperAttributeLabelAction($productSuperAttributeLabelAction)
414
    {
415
        $this->productSuperAttributeLabelAction = $productSuperAttributeLabelAction;
416
    }
417
418
    /**
419
     * Return's the action with the product super attribute label CRUD methods.
420
     *
421
     * @return \TechDivision\Import\Product\Variant\Actions\ProductSuperAttributeLabelAction The action instance
422
     */
423
    public function getProductSuperAttributeLabelAction()
424
    {
425
        return $this->productSuperAttributeLabelAction;
426
    }
427
428
    /**
429
     * Set's the action with the product super link CRUD methods.
430
     *
431
     * @param \TechDivision\Import\Product\Variant\Actions\ProductSuperLinkAction $productSuperLinkAction The action with the product super link CRUD methods
432
     *
433
     * @return void
434
     */
435
    public function setProductSuperLinkAction($productSuperLinkAction)
436
    {
437
        $this->productSuperLinkAction = $productSuperLinkAction;
438
    }
439
440
    /**
441
     * Return's the action with the product super link CRUD methods.
442
     *
443
     * @return \TechDivision\Import\Product\Variant\Actions\ProductSuperLinkAction The action instance
444
     */
445
    public function getProductSuperLinkAction()
446
    {
447
        return $this->productSuperLinkAction;
448
    }
449
450
    /**
451
     * Return's the attribute option value with the passed value and store ID.
452
     *
453
     * @param mixed   $value   The option value
454
     * @param integer $storeId The ID of the store
455
     *
456
     * @return array|boolean The attribute option value instance
457
     */
458
    public function getEavAttributeOptionValueByOptionValueAndStoreId($value, $storeId)
459
    {
460
        return $this->getEavAttributeOptionValueRepository()->findEavAttributeOptionValueByOptionValueAndStoreId($value, $storeId);
461
    }
462
463
    /**
464
     * Load's the product relation with the passed parent/child ID.
465
     *
466
     * @param integer $parentId The entity ID of the product relation's parent product
467
     * @param integer $childId  The entity ID of the product relation's child product
468
     *
469
     * @return array The product relation
470
     */
471
    public function loadProductRelation($parentId, $childId)
472
    {
473
        return $this->getProductRelationRepository()->findOneByParentIdAndChildId($parentId, $childId);
474
    }
475
476
    /**
477
     * Load's the product super link with the passed product/parent ID.
478
     *
479
     * @param integer $productId The entity ID of the product super link's product
480
     * @param integer $parentId  The entity ID of the product super link's parent product
481
     *
482
     * @return array The product super link
483
     */
484
    public function loadProductSuperLink($productId, $parentId)
485
    {
486
        return $this->getProductSuperLinkRepository()->findOneByProductIdAndParentId($productId, $parentId);
487
    }
488
489
    /**
490
     * Load's the product super attribute with the passed product/attribute ID.
491
     *
492
     * @param integer $productId   The entity ID of the product super attribute's product
493
     * @param integer $attributeId The attribute ID of the product super attributes attribute
494
     *
495
     * @return array The product super attribute
496
     */
497
    public function loadProductSuperAttribute($productId, $attributeId)
498
    {
499
        return $this->getProductSuperAttributeRepository()->findOneByProductIdAndAttributeId($productId, $attributeId);
500
    }
501
502
    /**
503
     * Load's the product super attribute label with the passed product super attribute/store ID.
504
     *
505
     * @param integer $productSuperAttributeId The product super attribute ID of the product super attribute label
506
     * @param integer $storeId                 The store ID of the product super attribute label
507
     *
508
     * @return array The product super attribute label
509
     */
510
    public function loadProductSuperAttributeLabel($productSuperAttributeId, $storeId)
511
    {
512
        return $this->getProductSuperAttributeLabelRepository()->findOneByProductSuperAttributeIdAndStoreId($productSuperAttributeId, $storeId);
513
    }
514
515
    /**
516
     * Persist's the passed product relation data and return's the ID.
517
     *
518
     * @param array       $productRelation The product relation data to persist
519
     * @param string|null $name            The name of the prepared statement that has to be executed
520
     *
521
     * @return void
522
     */
523
    public function persistProductRelation($productRelation, $name = null)
524
    {
525
        return $this->getProductRelationAction()->persist($productRelation, $name);
0 ignored issues
show
Unused Code introduced by
The call to ProductRelationAction::persist() has too many arguments starting with $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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
526
    }
527
528
    /**
529
     * Persist's the passed product super link data and return's the ID.
530
     *
531
     * @param array       $productSuperLink The product super link data to persist
532
     * @param string|null $name             The name of the prepared statement that has to be executed
533
     *
534
     * @return void
535
     */
536
    public function persistProductSuperLink($productSuperLink, $name = null)
537
    {
538
        return $this->getProductSuperLinkAction()->persist($productSuperLink, $name);
0 ignored issues
show
Unused Code introduced by
The call to ProductSuperLinkAction::persist() has too many arguments starting with $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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
539
    }
540
541
    /**
542
     * Persist's the passed product super attribute data and return's the ID.
543
     *
544
     * @param array       $productSuperAttribute The product super attribute data to persist
545
     * @param string|null $name                  The name of the prepared statement that has to be executed
546
     *
547
     * @return string The ID of the persisted product super attribute entity
548
     */
549
    public function persistProductSuperAttribute($productSuperAttribute, $name = null)
550
    {
551
        return $this->getProductSuperAttributeAction()->persist($productSuperAttribute, $name);
0 ignored issues
show
Unused Code introduced by
The call to ProductSuperAttributeAction::persist() has too many arguments starting with $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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
552
    }
553
554
    /**
555
     * Persist's the passed product super attribute label data and return's the ID.
556
     *
557
     * @param array       $productSuperAttributeLabel The product super attribute label data to persist
558
     * @param string|null $name                       The name of the prepared statement that has to be executed
559
     *
560
     * @return void
561
     */
562
    public function persistProductSuperAttributeLabel($productSuperAttributeLabel, $name = null)
563
    {
564
        return $this->getProductSuperAttributeLabelAction()->persist($productSuperAttributeLabel, $name);
0 ignored issues
show
Unused Code introduced by
The call to ProductSuperAttributeLabelAction::persist() has too many arguments starting with $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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
565
    }
566
}
567