Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Switch to techdivision/import-product-ee 18.* and techdivision/import-product-media 19.* version as dependency
  • Loading branch information
wagnert committed Sep 18, 2019
1 parent 46f4e7c commit 906b6b8
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 21 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Version 18.0.0

## Bugfixes

* None

## Features

* Add techdivision/import-cli-simple#216
* Switch to techdivision/import-product-ee 18.* and techdivision/import-product-media 19.* version as dependency

# Version 17.0.0

## Bugfixes
Expand Down
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
"license": "OSL-3.0",
"require": {
"php": ">=5.6.0",
"techdivision/import-product-ee": "17.*",
"techdivision/import-product-media": "18.*"
"techdivision/import": "15.x-dev as 15.0.0",
"techdivision/import-ee": "14.x-dev as 14.0.0",
"techdivision/import-product": "19.x-dev as 19.0.0",
"techdivision/import-product-ee": "18.x-dev as 18.0.0",
"techdivision/import-product-media": "19.x-dev as 19.0.0"
},
"require-dev": {
"doctrine/dbal": "2.5.*",
Expand All @@ -15,7 +18,7 @@
"sebastian/phpcpd": "~3.0.0",
"squizlabs/php_codesniffer": "3.3.1",
"consolidation/robo": "~1.0",
"mikey179/vfsStream": "~1.0",
"mikey179/vfsstream": "~1.0",
"symfony/http-kernel": "~3.4"
},
"authors": [
Expand Down
32 changes: 16 additions & 16 deletions src/Repositories/SqlStatementRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ class SqlStatementRepository extends \TechDivision\Import\Product\Media\Reposito
private $statements = array(
SqlStatementKeys::PRODUCT_MEDIA_GALLERY_VALUE =>
'SELECT *
FROM catalog_product_entity_media_gallery_value
FROM ${table:catalog_product_entity_media_gallery_value}
WHERE value_id = :value_id
AND store_id = :store_id
AND row_id = :row_id',
SqlStatementKeys::PRODUCT_MEDIA_GALLERY_VALUE_TO_ENTITY =>
'SELECT *
FROM catalog_product_entity_media_gallery_value_to_entity
FROM ${table:catalog_product_entity_media_gallery_value_to_entity}
WHERE value_id = :value_id
AND row_id = :row_id',
SqlStatementKeys::CREATE_PRODUCT_MEDIA_GALLERY_VALUE =>
'INSERT
INTO catalog_product_entity_media_gallery_value
INTO ${table:catalog_product_entity_media_gallery_value}
(value_id,
store_id,
row_id,
Expand All @@ -67,7 +67,7 @@ class SqlStatementRepository extends \TechDivision\Import\Product\Media\Reposito
:position,
:disabled)',
SqlStatementKeys::UPDATE_PRODUCT_MEDIA_GALLERY_VALUE =>
'UPDATE catalog_product_entity_media_gallery_value
'UPDATE ${table:catalog_product_entity_media_gallery_value}
SET value_id = :value_id,
store_id = :store_id,
row_id = :row_id,
Expand All @@ -77,33 +77,33 @@ class SqlStatementRepository extends \TechDivision\Import\Product\Media\Reposito
WHERE record_id = :record_id',
SqlStatementKeys::CREATE_PRODUCT_MEDIA_GALLERY_VALUE_TO_ENTITY =>
'INSERT
INTO catalog_product_entity_media_gallery_value_to_entity
INTO ${table:catalog_product_entity_media_gallery_value_to_entity}
(value_id,
row_id)
VALUES (:value_id,
:row_id)',
SqlStatementKeys::PRODUCT_MEDIA_GALLERIES_BY_SKU =>
'SELECT t3.*
FROM catalog_product_entity t1,
catalog_product_entity_media_gallery_value_to_entity t2,
catalog_product_entity_media_gallery t3
FROM ${table:catalog_product_entity} t1,
${table:catalog_product_entity_media_gallery_value_to_entity} t2,
${table:catalog_product_entity_media_gallery} t3
WHERE t1.sku = :sku
AND t2.row_id = t1.row_id
AND t3.value_id = t2.value_id'
);

/**
* Initialize the the SQL statements.
* Initializes the SQL statement repository with the primary key and table prefix utility.
*
* @param \IteratorAggregate<\TechDivision\Import\Utils\SqlCompilerInterface> $compilers The array with the compiler instances
*/
public function __construct()
public function __construct(\IteratorAggregate $compilers)
{

// call the parent constructor
parent::__construct();
// pass primary key + table prefix utility to parent instance
parent::__construct($compilers);

// merge the class statements
foreach ($this->statements as $key => $statement) {
$this->preparedStatements[$key] = $statement;
}
// compile the SQL statements
$this->compile($this->statements);
}
}
8 changes: 6 additions & 2 deletions symfony/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@

<services>

<service id="import_product_media.repository.sql.statement" class="TechDivision\Import\Product\Media\Ee\Repositories\SqlStatementRepository"/>
<service id="import_product_media_ee.repository.sql.statement" class="TechDivision\Import\Product\Media\Ee\Repositories\SqlStatementRepository"/>
<service id="import_product_media.repository.sql.statement" class="TechDivision\Import\Product\Media\Ee\Repositories\SqlStatementRepository">
<argument type="service" id="import.util.sql.compilers"/>
</service>
<service id="import_product_media_ee.repository.sql.statement" class="TechDivision\Import\Product\Media\Ee\Repositories\SqlStatementRepository">
<argument type="service" id="import.util.sql.compilers"/>
</service>
<service id="import_product_media_ee.repository.product.media.gallery.value" class="TechDivision\Import\Product\Media\Ee\Repositories\ProductMediaGalleryValueRepository">
<argument type="service" id="connection"/>
<argument type="service" id="import_product_media_ee.repository.sql.statement"/>
Expand Down

0 comments on commit 906b6b8

Please sign in to comment.