|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* TechDivision\Import\Product\Media\Ee\Services\EeProductMediaProcessor |
|
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\Ee\Services; |
|
22
|
|
|
|
|
23
|
|
|
use TechDivision\Import\Product\Media\Services\ProductMediaProcessor; |
|
24
|
|
|
use TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository; |
|
25
|
|
|
use TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueToEntityAction; |
|
26
|
|
|
use TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueVideoAction; |
|
27
|
|
|
use TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction; |
|
28
|
|
|
use TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueAction; |
|
29
|
|
|
use TechDivision\Import\Product\Media\Ee\Repositories\ProductMediaGalleryValueRepository; |
|
30
|
|
|
use TechDivision\Import\Product\Media\Ee\Repositories\ProductMediaGalleryValueToEntityRepository; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* A processor implementation that provides media import functionality for the Magento 2 EE. |
|
34
|
|
|
* |
|
35
|
|
|
* @author Tim Wagner <[email protected]> |
|
36
|
|
|
* @copyright 2016 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-product-media |
|
39
|
|
|
* @link http://www.techdivision.com |
|
40
|
|
|
*/ |
|
41
|
|
|
class EeProductMediaProcessor extends ProductMediaProcessor implements EeProductMediaProcessorInterface |
|
42
|
|
|
{ |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Initialize the processor with the necessary assembler and repository instances. |
|
46
|
|
|
* |
|
47
|
|
|
* @param \PDO $connection The PDO connection to use |
|
48
|
|
|
* @param \TechDivision\Import\Product\Media\Repositories\ProductMediaGalleryRepository $productMediaGalleryRepository The product media gallery repository to use |
|
49
|
|
|
* @param \TechDivision\Import\Product\Media\Ee\Repositories\ProductMediaGalleryValueRepository $productMediaGalleryValueRepository The product media gallery value repository to use |
|
50
|
|
|
* @param \TechDivision\Import\Product\Media\Ee\Repositories\ProductMediaGalleryValueToEntityRepository $productMediaGalleryValueToEntityRepository The product media gallery value to entity repository to use |
|
51
|
|
|
* @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryAction $productMediaGalleryAction The product media gallery action to use |
|
52
|
|
|
* @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueAction $productMediaGalleryValueAction The product media gallery value action to use |
|
53
|
|
|
* @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryValueToEntityAction $productMediaGalleryValueToEntityAction The product media gallery value to entity action to use |
|
54
|
|
|
* @param \TechDivision\Import\Product\Media\Actions\ProductMediaGalleryVideoAction $productMediaGalleryValueVideoAction The product media gallery value video action to use |
|
55
|
|
|
*/ |
|
56
|
|
|
public function __construct( |
|
57
|
|
|
\PDO $connection, |
|
58
|
|
|
ProductMediaGalleryRepository $productMediaGalleryRepository, |
|
59
|
|
|
ProductMediaGalleryValueRepository $productMediaGalleryValueRepository, |
|
60
|
|
|
ProductMediaGalleryValueToEntityRepository $productMediaGalleryValueToEntityRepository, |
|
61
|
|
|
ProductMediaGalleryAction $productMediaGalleryAction, |
|
62
|
|
|
ProductMediaGalleryValueAction $productMediaGalleryValueAction, |
|
63
|
|
|
ProductMediaGalleryValueToEntityAction $productMediaGalleryValueToEntityAction, |
|
64
|
|
|
ProductMediaGalleryValueVideoAction $productMediaGalleryValueVideoAction |
|
65
|
|
|
) { |
|
66
|
|
|
$this->setConnection($connection); |
|
67
|
|
|
$this->setProductMediaGalleryRepository($productMediaGalleryRepository); |
|
68
|
|
|
$this->setProductMediaGalleryValueRepository($productMediaGalleryValueRepository); |
|
69
|
|
|
$this->setProductMediaGalleryValueToEntityRepository($productMediaGalleryValueToEntityRepository); |
|
70
|
|
|
$this->setProductMediaGalleryAction($productMediaGalleryAction); |
|
71
|
|
|
$this->setProductMediaGalleryValueAction($productMediaGalleryValueAction); |
|
|
|
|
|
|
72
|
|
|
$this->setProductMediaGalleryValueToEntityAction($productMediaGalleryValueToEntityAction); |
|
|
|
|
|
|
73
|
|
|
$this->setProductMediaGalleryValueVideoAction($productMediaGalleryValueVideoAction); |
|
|
|
|
|
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Load's the product media gallery with the passed value/row ID. |
|
78
|
|
|
* |
|
79
|
|
|
* @param integer $valueId The value ID of the product media gallery value to entity to load |
|
80
|
|
|
* @param integer $rowId The row ID of the product media gallery value to entity to load |
|
81
|
|
|
* |
|
82
|
|
|
* @return array The product media gallery |
|
83
|
|
|
*/ |
|
84
|
|
|
public function loadProductMediaGalleryValueToEntityByValueIdAndRowId($valueId, $rowId) |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->getProductMediaGalleryValueToEntityRepository()->findOneByValueIdAndEntityId($valueId, $rowId); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Load's the product media gallery value with the passed value/store/row ID. |
|
91
|
|
|
* |
|
92
|
|
|
* @param integer $valueId The value ID of the product media gallery value to load |
|
93
|
|
|
* @param string $storeId The store ID of the product media gallery value to load |
|
94
|
|
|
* @param string $rowId The row ID of the parent product of the product media gallery value to load |
|
95
|
|
|
* |
|
96
|
|
|
* @return array The product media gallery value |
|
97
|
|
|
*/ |
|
98
|
|
|
public function loadProductMediaGalleryValueByValueIdAndStoreIdAndRowId($valueId, $storeId, $rowId) |
|
99
|
|
|
{ |
|
100
|
|
|
return $this->getProductMediaGalleryValueRepository()->findOneByValueIdAndStoreIdAndEntityId($valueId, $storeId, $rowId); |
|
101
|
|
|
} |
|
102
|
|
|
} |
|
103
|
|
|
|
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: