1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Cli\Services\EeProductMediaProcessorFactory |
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-cli-simple |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Cli\Services; |
22
|
|
|
|
23
|
|
|
use TechDivision\Import\Configuration\SubjectInterface; |
24
|
|
|
use TechDivision\Import\Product\Media\Ee\Repositories\ProductMediaGalleryValueRepository; |
25
|
|
|
use TechDivision\Import\Product\Media\Ee\Repositories\ProductMediaGalleryValueToEntityRepository; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* A SLSB providing methods to load product data using a PDO connection. |
29
|
|
|
* |
30
|
|
|
* @author Tim Wagner <[email protected]> |
31
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
32
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
33
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
34
|
|
|
* @link http://www.techdivision.com |
35
|
|
|
*/ |
36
|
|
|
class EeProductMediaProcessorFactory extends ProductMediaProcessorFactory |
37
|
|
|
{ |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Return's the processor class name. |
41
|
|
|
* |
42
|
|
|
* @return string The processor class name |
43
|
|
|
*/ |
44
|
|
|
protected static function getProcessorType() |
45
|
|
|
{ |
46
|
|
|
return 'TechDivision\Import\Product\Media\Ee\Services\EeProductMediaProcessor'; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Factory method to create a new product processor instance. |
51
|
|
|
* |
52
|
|
|
* @param \PDO $connection The PDO connection to use |
53
|
|
|
* @param TechDivision\Import\Configuration\SubjectInterface $configuration The subject configuration |
54
|
|
|
* |
55
|
|
|
* @return \TechDivision\Import\Product\Services\ProductProcessor The processor instance |
56
|
|
|
*/ |
57
|
|
|
public static function factory(\PDO $connection, SubjectInterface $configuration) |
58
|
|
|
{ |
59
|
|
|
|
60
|
|
|
// initialize the product processor |
61
|
|
|
$productMediaProcessor = parent::factory($connection, $configuration); |
62
|
|
|
|
63
|
|
|
// load the utility class name |
64
|
|
|
$utilityClassName = $configuration->getUtilityClassName(); |
65
|
|
|
|
66
|
|
|
// initialize the repository that provides product media gallery value to entity query functionality |
67
|
|
|
$productMediaGalleryValueToEntityRepository = new ProductMediaGalleryValueToEntityRepository(); |
68
|
|
|
$productMediaGalleryValueToEntityRepository->setUtilityClassName($utilityClassName); |
69
|
|
|
$productMediaGalleryValueToEntityRepository->setConnection($connection); |
70
|
|
|
$productMediaGalleryValueToEntityRepository->init(); |
71
|
|
|
|
72
|
|
|
// initialize the repository that provides product media gallery value query functionality |
73
|
|
|
$productMediaGalleryValueRepository = new ProductMediaGalleryValueRepository(); |
74
|
|
|
$productMediaGalleryValueRepository->setUtilityClassName($utilityClassName); |
75
|
|
|
$productMediaGalleryValueRepository->setConnection($connection); |
76
|
|
|
$productMediaGalleryValueRepository->init(); |
77
|
|
|
|
78
|
|
|
// initialize the product media processor |
79
|
|
|
$productMediaProcessor->setProductMediaGalleryValueRepository($productMediaGalleryValueRepository); |
80
|
|
|
$productMediaProcessor->setProductMediaGalleryValueToEntityRepository($productMediaGalleryValueToEntityRepository); |
81
|
|
|
|
82
|
|
|
// return the instance |
83
|
|
|
return $productMediaProcessor; |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|