1 | <?php |
||
34 | class SqlStatementRepository extends \TechDivision\Import\Product\Repositories\SqlStatementRepository |
||
35 | { |
||
36 | |||
37 | /** |
||
38 | * The SQL statements. |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | private $statements = array( |
||
|
|||
43 | SqlStatementKeys::PRODUCT_MEDIA_GALLERY => |
||
44 | 'SELECT * |
||
45 | FROM catalog_product_entity_media_gallery |
||
46 | WHERE attribute_id = :attribute_id |
||
47 | AND value = :value', |
||
48 | SqlStatementKeys::PRODUCT_MEDIA_GALLERY_VALUE => |
||
49 | 'SELECT * |
||
50 | FROM catalog_product_entity_media_gallery_value |
||
51 | WHERE value_id = :value_id |
||
52 | AND store_id = :store_id |
||
53 | AND entity_id = :entity_id', |
||
54 | SqlStatementKeys::PRODUCT_MEDIA_GALLERY_VALUE_TO_ENTITY => |
||
55 | 'SELECT * |
||
56 | FROM catalog_product_entity_media_gallery_value_to_entity |
||
57 | WHERE value_id = :value_id |
||
58 | AND entity_id = :entity_id', |
||
59 | SqlStatementKeys::CREATE_PRODUCT_MEDIA_GALLERY => |
||
60 | 'INSERT |
||
61 | INTO catalog_product_entity_media_gallery |
||
62 | (attribute_id, |
||
63 | value, |
||
64 | media_type, |
||
65 | disabled) |
||
66 | VALUES (:attribute_id, |
||
67 | :value, |
||
68 | :media_type, |
||
69 | :disabled)', |
||
70 | SqlStatementKeys::UPDATE_PRODUCT_MEDIA_GALLERY => |
||
71 | 'UPDATE catalog_product_entity_media_gallery |
||
72 | SET attribute_id = :attribute_id, |
||
73 | value = :value, |
||
74 | media_type = :media_type, |
||
75 | disabled = :disabled |
||
76 | WHERE value_id = :value_id', |
||
77 | SqlStatementKeys::DELETE_PRODUCT_MEDIA_GALLERY => |
||
78 | 'DELETE |
||
79 | FROM catalog_product_entity_media_gallery |
||
80 | WHERE value_id = :value_id', |
||
81 | SqlStatementKeys::CREATE_PRODUCT_MEDIA_GALLERY_VALUE => |
||
82 | 'INSERT |
||
83 | INTO catalog_product_entity_media_gallery_value |
||
84 | (value_id, |
||
85 | store_id, |
||
86 | entity_id, |
||
87 | label, |
||
88 | position, |
||
89 | disabled) |
||
90 | VALUES (:value_id, |
||
91 | :store_id, |
||
92 | :entity_id, |
||
93 | :label, |
||
94 | :position, |
||
95 | :disabled)', |
||
96 | SqlStatementKeys::UPDATE_PRODUCT_MEDIA_GALLERY_VALUE => |
||
97 | 'UPDATE catalog_product_entity_media_gallery_value |
||
98 | SET value_id = :value_id, |
||
99 | store_id = :store_id, |
||
100 | entity_id = :entity_id, |
||
101 | label = :label, |
||
102 | position = :position, |
||
103 | disabled = :disabled |
||
104 | WHERE record_id = :record_id', |
||
105 | SqlStatementKeys::CREATE_PRODUCT_MEDIA_GALLERY_VALUE_TO_ENTITY => |
||
106 | 'INSERT |
||
107 | INTO catalog_product_entity_media_gallery_value_to_entity |
||
108 | (value_id, |
||
109 | entity_id) |
||
110 | VALUES (:value_id, |
||
111 | :entity_id)', |
||
112 | SqlStatementKeys::CREATE_PRODUCT_MEDIA_GALLERY_VALUE_VIDEO => |
||
113 | 'INSERT |
||
114 | INTO catalog_product_entity_media_gallery_value_video |
||
115 | (value_id, |
||
116 | store_id, |
||
117 | provider, |
||
118 | url, |
||
119 | title, |
||
120 | description, |
||
121 | metadata) |
||
122 | VALUES (:value_id, |
||
123 | :store_id, |
||
124 | :provider, |
||
125 | :url, |
||
126 | :title, |
||
127 | :description, |
||
128 | :metadata)', |
||
129 | SqlStatementKeys::PRODUCT_MEDIA_GALLERIES_BY_SKU => |
||
130 | 'SELECT t3.* |
||
131 | FROM catalog_product_entity t1, |
||
132 | catalog_product_entity_media_gallery_value_to_entity t2, |
||
133 | catalog_product_entity_media_gallery t3 |
||
134 | WHERE t1.sku = :sku |
||
135 | AND t2.entity_id = t1.entity_id |
||
136 | AND t3.value_id = t2.value_id' |
||
137 | ); |
||
138 | |||
139 | /** |
||
140 | * Initialize the the SQL statements. |
||
141 | */ |
||
142 | public function __construct() |
||
150 | } |
||
151 |