1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Product\Media\Ee\\Utils\SqlStatements |
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-ee |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Product\Media\Ee\Utils; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Utility class with the SQL statements to use. |
25
|
|
|
* |
26
|
|
|
* @author Tim Wagner <[email protected]> |
27
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
28
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
29
|
|
|
* @link https://github.com/techdivision/import-product-media-ee |
30
|
|
|
* @link http://www.techdivision.com |
31
|
|
|
*/ |
32
|
|
|
class SqlStatements extends \TechDivision\Import\Product\Media\Utils\SqlStatements |
33
|
|
|
{ |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* The SQL statement to load an existing product media gallery by value/store/entity ID. |
37
|
|
|
* |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
const PRODUCT_MEDIA_GALLERY_VALUE = 'product_media_gallery_value'; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* The SQL statement to load an existing product media gallery value to entity by value/entity ID. |
44
|
|
|
* |
45
|
|
|
* @var string |
46
|
|
|
*/ |
47
|
|
|
const PRODUCT_MEDIA_GALLERY_VALUE_TO_ENTITY = 'product_media_gallery_value_to_entity'; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* The SQL statement to create a new product media gallery value entry. |
51
|
|
|
* |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
const CREATE_PRODUCT_MEDIA_GALLERY_VALUE = 'create.product_media_gallery_value'; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* The SQL statement to update an existing product media gallery value entry. |
58
|
|
|
* |
59
|
|
|
* @var string |
60
|
|
|
*/ |
61
|
|
|
const UPDATE_PRODUCT_MEDIA_GALLERY_VALUE = 'update.product_media_gallery_value'; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* The SQL statement to create a new product media gallery value to entity entry. |
65
|
|
|
* |
66
|
|
|
* @var string |
67
|
|
|
*/ |
68
|
|
|
const CREATE_PRODUCT_MEDIA_GALLERY_VALUE_TO_ENTITY = 'create.product_media_gallery_value_to_entity'; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* The SQL statements. |
72
|
|
|
* |
73
|
|
|
* @var array |
74
|
|
|
*/ |
75
|
|
|
private $statements = array( |
|
|
|
|
76
|
|
|
SqlStatements::PRODUCT_MEDIA_GALLERY_VALUE => |
77
|
|
|
'SELECT * |
78
|
|
|
FROM catalog_product_entity_media_gallery_value |
79
|
|
|
WHERE value_id = :value_id |
80
|
|
|
AND store_id = :store_id |
81
|
|
|
AND row_id = :row_id', |
82
|
|
|
SqlStatements::PRODUCT_MEDIA_GALLERY_VALUE_TO_ENTITY => |
83
|
|
|
'SELECT * |
84
|
|
|
FROM catalog_product_entity_media_gallery_value_to_entity |
85
|
|
|
WHERE value_id = :value_id |
86
|
|
|
AND row_id = :row_id', |
87
|
|
|
SqlStatements::CREATE_PRODUCT_MEDIA_GALLERY_VALUE => |
88
|
|
|
'INSERT |
89
|
|
|
INTO catalog_product_entity_media_gallery_value |
90
|
|
|
(value_id, |
91
|
|
|
store_id, |
92
|
|
|
row_id, |
93
|
|
|
label, |
94
|
|
|
position, |
95
|
|
|
disabled) |
96
|
|
|
VALUES (:value_id, |
97
|
|
|
:store_id, |
98
|
|
|
:row_id, |
99
|
|
|
:label, |
100
|
|
|
:position, |
101
|
|
|
:disabled)', |
102
|
|
|
SqlStatements::UPDATE_PRODUCT_MEDIA_GALLERY_VALUE => |
103
|
|
|
'UPDATE catalog_product_entity_media_gallery_value |
104
|
|
|
SET value_id = :value_id, |
105
|
|
|
store_id = :store_id, |
106
|
|
|
row_id = :row_id, |
107
|
|
|
label = :label, |
108
|
|
|
position = :position, |
109
|
|
|
disabled = :disabled |
110
|
|
|
WHERE record_id = :record_id', |
111
|
|
|
SqlStatements::CREATE_PRODUCT_MEDIA_GALLERY_VALUE_TO_ENTITY => |
112
|
|
|
'INSERT |
113
|
|
|
INTO catalog_product_entity_media_gallery_value_to_entity |
114
|
|
|
(value_id, |
115
|
|
|
row_id) |
116
|
|
|
VALUES (:value_id, |
117
|
|
|
:row_id)', |
118
|
|
|
); |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* Initialize the the SQL statements. |
122
|
|
|
*/ |
123
|
|
|
public function __construct() |
124
|
|
|
{ |
125
|
|
|
|
126
|
|
|
// call the parent constructor |
127
|
|
|
parent::__construct(); |
128
|
|
|
|
129
|
|
|
// merge the class statements |
130
|
|
|
foreach ($this->statements as $key => $statement) { |
131
|
|
|
$this->preparedStatements[$key] = $statement; |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
|