Completed
Push — master ( 011a28...d9e020 )
by Tim
13s
created

getProductMediaGalleryValueRepository()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * TechDivision\Import\Product\Media\Services\ProductMediaProcessor
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-media
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Product\Media\Services;
22
23
use TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository;
24
use TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository;
25
use TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository;
26
use TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueToEntityAction;
27
use TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueVideoAction;
28
use TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction;
29
use TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueAction;
30
31
/**
32
 * A SLSB providing methods to load product data using a PDO connection.
33
 *
34
 * @author    Tim Wagner <[email protected]>
35
 * @copyright 2016 TechDivision GmbH <[email protected]>
36
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
37
 * @link      https://github.com/techdivision/import-product-media
38
 * @link      http://www.techdivision.com
39
 */
40
class ProductMediaProcessor implements ProductMediaProcessorInterface
41
{
42
43
    /**
44
     * A PDO connection initialized with the values from the Doctrine EntityManager.
45
     *
46
     * @var \PDO
47
     */
48
    protected $connection;
49
50
    /**
51
     * The repository to load product media galleries.
52
     *
53
     * @var \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository
54
     */
55
    protected $productMediaGalleryRepository;
56
57
    /**
58
     * The repository to load product media gallery to entities.
59
     *
60
     * @var \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository
61
     */
62
    protected $productMediaGalleryValueToEntityRepository;
63
64
    /**
65
     * The repository to load product media gallery values.
66
     *
67
     * @var \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository
68
     */
69
    protected $productMediaGalleryValueRepository;
70
71
    /**
72
     * The action with the product media gallery CRUD methods.
73
     *
74
     * @var \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction
75
     */
76
    protected $productMediaGalleryAction;
77
78
    /**
79
     * The action with the product media gallery value CRUD methods.
80
     *
81
     * @var \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueAction
82
     */
83
    protected $productMediaGalleryValueAction;
84
85
    /**
86
     * The action with the product media gallery value to entity CRUD methods.
87
     *
88
     * @var \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueToEntityAction
89
     */
90
    protected $productMediaGalleryValueToEntityAction;
91
92
    /**
93
     * The action with the product media gallery video CRUD methods.
94
     *
95
     * @var \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryVideoAction
96
     */
97
    protected $productMediaGalleryVideoAction;
98
99
    /**
100
     * Initialize the processor with the necessary assembler and repository instances.
101
     *
102
     * @param \PDO                                                                                       $connection                                 The PDO connection to use
103
     * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository              $productMediaGalleryRepository              The product media gallery repository to use
104
     * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository         $productMediaGalleryValueRepository         The product media gallery value repository to use
105
     * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository $productMediaGalleryValueToEntityRepository The product media gallery value to entity repository to use
106
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction                       $productMediaGalleryAction                  The product media gallery action to use
107
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueAction                  $productMediaGalleryValueAction             The product media gallery value action to use
108
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueToEntityAction          $productMediaGalleryValueToEntityAction     The product media gallery value to entity action to use
109
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryVideoAction                  $productMediaGalleryValueVideoAction        The product media gallery value video action to use
110
     */
111
    public function __construct(
112
        \PDO $connection,
113
        ProductMediaGalleryRepository $productMediaGalleryRepository,
114
        ProductMediaGalleryValueRepository $productMediaGalleryValueRepository,
115
        ProductMediaGalleryValueToEntityRepository $productMediaGalleryValueToEntityRepository,
116
        ProductMediaGalleryAction $productMediaGalleryAction,
117
        ProductMediaGalleryValueAction $productMediaGalleryValueAction,
118
        ProductMediaGalleryValueToEntityAction $productMediaGalleryValueToEntityAction,
119
        ProductMediaGalleryValueVideoAction $productMediaGalleryValueVideoAction
120
    ) {
121
        $this->setConnection($connection);
122
        $this->setProductMediaGalleryRepository($productMediaGalleryRepository);
123
        $this->setProductMediaGalleryValueRepository($productMediaGalleryValueRepository);
124
        $this->setProductMediaGalleryValueToEntityRepository($productMediaGalleryValueToEntityRepository);
125
        $this->setProductMediaGalleryAction($productMediaGalleryAction);
126
        $this->setProductMediaGalleryValueAction($productMediaGalleryValueAction);
0 ignored issues
show
Documentation introduced by
$productMediaGalleryValueAction is of type object<TechDivision\Impo...ediaGalleryValueAction>, but the function expects a object<TechDivision\Impo...ductMediaGalleryAction>.

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...
127
        $this->setProductMediaGalleryValueToEntityAction($productMediaGalleryValueToEntityAction);
0 ignored issues
show
Documentation introduced by
$productMediaGalleryValueToEntityAction is of type object<TechDivision\Impo...eryValueToEntityAction>, but the function expects a object<TechDivision\Impo...ductMediaGalleryAction>.

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...
128
        $this->setProductMediaGalleryValueVideoAction($productMediaGalleryValueVideoAction);
0 ignored issues
show
Documentation introduced by
$productMediaGalleryValueVideoAction is of type object<TechDivision\Impo...alleryValueVideoAction>, but the function expects a object<TechDivision\Impo...ductMediaGalleryAction>.

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...
129
    }
130
131
    /**
132
     * Set's the passed connection.
133
     *
134
     * @param \PDO $connection The connection to set
135
     *
136
     * @return void
137
     */
138
    public function setConnection(\PDO $connection)
139
    {
140
        $this->connection = $connection;
141
    }
142
143
    /**
144
     * Return's the connection.
145
     *
146
     * @return \PDO The connection instance
147
     */
148
    public function getConnection()
149
    {
150
        return $this->connection;
151
    }
152
153
    /**
154
     * Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO
155
     * object instance are not committed until you end the transaction by calling ProductProcessor::commit().
156
     * Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection
157
     * to autocommit mode.
158
     *
159
     * @return boolean Returns TRUE on success or FALSE on failure
160
     * @link http://php.net/manual/en/pdo.begintransaction.php
161
     */
162
    public function beginTransaction()
163
    {
164
        return $this->connection->beginTransaction();
165
    }
166
167
    /**
168
     * Commits a transaction, returning the database connection to autocommit mode until the next call to
169
     * ProductProcessor::beginTransaction() starts a new transaction.
170
     *
171
     * @return boolean Returns TRUE on success or FALSE on failure
172
     * @link http://php.net/manual/en/pdo.commit.php
173
     */
174
    public function commit()
175
    {
176
        return $this->connection->commit();
177
    }
178
179
    /**
180
     * Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction().
181
     *
182
     * If the database was set to autocommit mode, this function will restore autocommit mode after it has
183
     * rolled back the transaction.
184
     *
185
     * Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition
186
     * language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit
187
     * COMMIT will prevent you from rolling back any other changes within the transaction boundary.
188
     *
189
     * @return boolean Returns TRUE on success or FALSE on failure
190
     * @link http://php.net/manual/en/pdo.rollback.php
191
     */
192
    public function rollBack()
193
    {
194
        return $this->connection->rollBack();
195
    }
196
197
    /**
198
     * Set's the repository to load product media gallery data.
199
     *
200
     * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository $productMediaGalleryRepository The repository instance
201
     *
202
     * @return void
203
     */
204
    public function setProductMediaGalleryRepository($productMediaGalleryRepository)
205
    {
206
        $this->productMediaGalleryRepository = $productMediaGalleryRepository;
207
    }
208
209
    /**
210
     * Return's the repository to load product media gallery data.
211
     *
212
     * @return \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository The repository instance
213
     */
214
    public function getProductMediaGalleryRepository()
215
    {
216
        return $this->productMediaGalleryRepository;
217
    }
218
219
    /**
220
     * Set's the repository to load product media gallery value to entity data.
221
     *
222
     * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository $productMediaGalleryValueToEntityRepository The repository instance
223
     *
224
     * @return void
225
     */
226
    public function setProductMediaGalleryValueToEntityRepository($productMediaGalleryValueToEntityRepository)
227
    {
228
        $this->productMediaGalleryValueToEntityRepository = $productMediaGalleryValueToEntityRepository;
229
    }
230
231
    /**
232
     * Return's the repository to load product media gallery value to entity data.
233
     *
234
     * @return \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueToEntityRepository The repository instance
235
     */
236
    public function getProductMediaGalleryValueToEntityRepository()
237
    {
238
        return $this->productMediaGalleryValueToEntityRepository;
239
    }
240
241
    /**
242
     * Set's the repository to load product media gallery value data.
243
     *
244
     * @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository $productMediaGalleryValueRepository The repository instance
245
     *
246
     * @return void
247
     */
248
    public function setProductMediaGalleryValueRepository($productMediaGalleryValueRepository)
249
    {
250
        $this->productMediaGalleryValueRepository = $productMediaGalleryValueRepository;
251
    }
252
253
    /**
254
     * Return's the repository to load product media gallery value data.
255
     *
256
     * @return \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryValueRepository The repository instance
257
     */
258
    public function getProductMediaGalleryValueRepository()
259
    {
260
        return $this->productMediaGalleryValueRepository;
261
    }
262
263
    /**
264
     * Set's the action with the product media gallery CRUD methods.
265
     *
266
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryAction The action with the product media gallery CRUD methods
267
     *
268
     * @return void
269
     */
270
    public function setProductMediaGalleryAction($productMediaGalleryAction)
271
    {
272
        $this->productMediaGalleryAction = $productMediaGalleryAction;
273
    }
274
275
    /**
276
     * Return's the action with the product media gallery CRUD methods.
277
     *
278
     * @return \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction The action with the product media gallery CRUD methods
279
     */
280
    public function getProductMediaGalleryAction()
281
    {
282
        return $this->productMediaGalleryAction;
283
    }
284
285
    /**
286
     * Set's the action with the product media gallery valueCRUD methods.
287
     *
288
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryValueAction The action with the product media gallery value CRUD methods
289
     *
290
     * @return void
291
     */
292
    public function setProductMediaGalleryValueAction($productMediaGalleryValueAction)
293
    {
294
        $this->productMediaGalleryValueAction = $productMediaGalleryValueAction;
0 ignored issues
show
Documentation Bug introduced by
It seems like $productMediaGalleryValueAction of type object<TechDivision\Impo...ductMediaGalleryAction> is incompatible with the declared type object<TechDivision\Impo...ediaGalleryValueAction> of property $productMediaGalleryValueAction.

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...
295
    }
296
297
    /**
298
     * Return's the action with the product media gallery valueCRUD methods.
299
     *
300
     * @return \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction The action with the product media gallery value CRUD methods
301
     */
302
    public function getProductMediaGalleryValueAction()
303
    {
304
        return $this->productMediaGalleryValueAction;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->productMediaGalleryValueAction; (TechDivision\Import\Prod...MediaGalleryValueAction) is incompatible with the return type declared by the interface TechDivision\Import\Prod...MediaGalleryValueAction of type TechDivision\Import\Prod...oductMediaGalleryAction.

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...
305
    }
306
307
    /**
308
     * Set's the action with the product media gallery value to entity CRUD methods.
309
     *
310
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryValueToEntityAction The action with the product media gallery value to entity CRUD methods
311
     *
312
     * @return void
313
     */
314
    public function setProductMediaGalleryValueToEntityAction($productMediaGalleryValueToEntityAction)
315
    {
316
        $this->productMediaGalleryValueToEntityAction = $productMediaGalleryValueToEntityAction;
0 ignored issues
show
Documentation Bug introduced by
It seems like $productMediaGalleryValueToEntityAction of type object<TechDivision\Impo...ductMediaGalleryAction> is incompatible with the declared type object<TechDivision\Impo...eryValueToEntityAction> of property $productMediaGalleryValueToEntityAction.

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...
317
    }
318
319
    /**
320
     * Return's the action with the product media gallery value to entity CRUD methods.
321
     *
322
     * @return \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryAction The action with the product media gallery value to entity CRUD methods
323
     */
324
    public function getProductMediaGalleryValueToEntityAction()
325
    {
326
        return $this->productMediaGalleryValueToEntityAction;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->productMed...eryValueToEntityAction; (TechDivision\Import\Prod...leryValueToEntityAction) is incompatible with the return type declared by the interface TechDivision\Import\Prod...leryValueToEntityAction of type TechDivision\Import\Prod...oductMediaGalleryAction.

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...
327
    }
328
329
    /**
330
     * Set's the action with the product media gallery value video CRUD methods.
331
     *
332
     * @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryValueVideoAction The action with the product media gallery value video CRUD methods
333
     *
334
     * @return void
335
     */
336
    public function setProductMediaGalleryValueVideoAction($productMediaGalleryValueVideoAction)
337
    {
338
        $this->productMediaGalleryValueVideoAction = $productMediaGalleryValueVideoAction;
0 ignored issues
show
Bug introduced by
The property productMediaGalleryValueVideoAction does not seem to exist. Did you mean productMediaGalleryValueAction?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
339
    }
340
341
    /**
342
     * Return's the action with the product media gallery value video CRUD methods.
343
     *
344
     * @return \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction The action with the product media gallery value video CRUD methods
345
     */
346
    public function getProductMediaGalleryValueVideoAction()
347
    {
348
        return $this->productMediaGalleryValueVideoAction;
0 ignored issues
show
Bug introduced by
The property productMediaGalleryValueVideoAction does not seem to exist. Did you mean productMediaGalleryValueAction?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
349
    }
350
351
    /**
352
     * Load's the product media gallery with the passed attribute ID + value.
353
     *
354
     * @param integer $attributeId The attribute ID of the product media gallery to load
355
     * @param string  $value       The value of the product media gallery to load
356
     *
357
     * @return array The product media gallery
358
     */
359
    public function loadProductMediaGallery($attributeId, $value)
360
    {
361
        return $this->getProductMediaGalleryRepository()->findOneByAttributeIdAndValue($attributeId, $value);
362
    }
363
364
    /**
365
     * Load's the product media gallery with the passed value/entity ID.
366
     *
367
     * @param integer $valueId  The value ID of the product media gallery value to entity to load
368
     * @param integer $entityId The entity ID of the product media gallery value to entity to load
369
     *
370
     * @return array The product media gallery
371
     */
372
    public function loadProductMediaGalleryValueToEntity($valueId, $entityId)
373
    {
374
        return $this->getProductMediaGalleryValueToEntityRepository()->findOneByValueIdAndEntityId($valueId, $entityId);
375
    }
376
377
    /**
378
     * Load's the product media gallery value with the passed value/store/parent ID.
379
     *
380
     * @param integer $valueId  The value ID of the product media gallery value to load
381
     * @param string  $storeId  The store ID of the product media gallery value to load
382
     * @param string  $entityId The entity ID of the parent product of the product media gallery value to load
383
     *
384
     * @return array The product media gallery value
385
     */
386
    public function loadProductMediaGalleryValue($valueId, $storeId, $entityId)
387
    {
388
        return $this->getProductMediaGalleryValueRepository()->findOneByValueIdAndStoreIdAndEntityId($valueId, $storeId, $entityId);
389
    }
390
391
    /**
392
     * Persist's the passed product media gallery data and return's the ID.
393
     *
394
     * @param array       $productMediaGallery The product media gallery data to persist
395
     * @param string|null $name                The name of the prepared statement that has to be executed
396
     *
397
     * @return string The ID of the persisted entity
398
     */
399
    public function persistProductMediaGallery($productMediaGallery, $name = null)
400
    {
401
        return $this->getProductMediaGalleryAction()->persist($productMediaGallery, $name);
0 ignored issues
show
Unused Code introduced by
The call to ProductMediaGalleryAction::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...
402
    }
403
404
    /**
405
     * Persist's the passed product media gallery value data.
406
     *
407
     * @param array       $productMediaGalleryValue The product media gallery value data to persist
408
     * @param string|null $name                     The name of the prepared statement that has to be executed
409
     *
410
     * @return void
411
     */
412
    public function persistProductMediaGalleryValue($productMediaGalleryValue, $name = null)
413
    {
414
        $this->getProductMediaGalleryValueAction()->persist($productMediaGalleryValue, $name);
0 ignored issues
show
Unused Code introduced by
The call to ProductMediaGalleryValueAction::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...
415
    }
416
417
    /**
418
     * Persist's the passed product media gallery value to entity data.
419
     *
420
     * @param array       $productMediaGalleryValuetoEntity The product media gallery value to entity data to persist
421
     * @param string|null $name                             The name of the prepared statement that has to be executed
422
     *
423
     * @return void
424
     */
425
    public function persistProductMediaGalleryValueToEntity($productMediaGalleryValuetoEntity, $name = null)
426
    {
427
        $this->getProductMediaGalleryValueToEntityAction()->persist($productMediaGalleryValuetoEntity, $name);
0 ignored issues
show
Unused Code introduced by
The call to ProductMediaGalleryValueToEntityAction::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...
428
    }
429
430
    /**
431
     * Persist's the passed product media gallery value video data.
432
     *
433
     * @param array       $productMediaGalleryValueVideo The product media gallery value video data to persist
434
     * @param string|null $name                          The name of the prepared statement that has to be executed
435
     *
436
     * @return void
437
     */
438
    public function persistProductMediaGalleryValueVideo($productMediaGalleryValueVideo, $name = null)
439
    {
440
        $this->getProductMediaGalleryValueVideoAction()->persist($productMediaGalleryValueVideo, $name);
0 ignored issues
show
Unused Code introduced by
The call to ProductMediaGalleryAction::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...
441
    }
442
}
443