Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Switch to latest techdivision/import-product 19.* version as dependency
  • Loading branch information
wagnert committed Sep 18, 2019
1 parent 1e0a045 commit ee31b94
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 22 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 latest techdivision/import-product 19.* version as dependency

# Version 17.0.0

## Bugfixes
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"license": "OSL-3.0",
"require": {
"php": ">=5.6.0",
"techdivision/import-product": "18.*"
"techdivision/import": "15.x-dev as 15.0.0",
"techdivision/import-product": "19.x-dev as 19.0.0"
},
"require-dev": {
"doctrine/dbal": "2.5.*",
Expand All @@ -14,7 +15,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
41 changes: 22 additions & 19 deletions src/Repositories/SqlStatementRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,35 @@ class SqlStatementRepository extends \TechDivision\Import\Product\Repositories\S
private $statements = array(
SqlStatementKeys::BUNDLE_OPTION =>
'SELECT t0.*
FROM catalog_product_bundle_option t0
INNER JOIN catalog_product_bundle_option_value t1
FROM ${table:catalog_product_bundle_option} t0
INNER JOIN ${table:catalog_product_bundle_option_value} t1
ON t0.parent_id = :parent_id
AND t0.option_id = t1.option_id
AND t1.title = :title
AND t1.store_id = :store_id',
SqlStatementKeys::BUNDLE_OPTION_VALUE =>
'SELECT t0.*
FROM catalog_product_bundle_option_value t0
INNER JOIN catalog_product_bundle_option t1
FROM ${table:catalog_product_bundle_option_value} t0
INNER JOIN ${table:catalog_product_bundle_option} t1
ON t1.parent_id = :parent_id
AND t0.option_id = t1.option_id
AND t0.title = :title
AND t0.store_id = :store_id',
SqlStatementKeys::BUNDLE_SELECTION =>
'SELECT *
FROM catalog_product_bundle_selection
FROM ${table:catalog_product_bundle_selection}
WHERE option_id = :option_id
AND parent_product_id = :parent_product_id
AND product_id = :product_id',
SqlStatementKeys::BUNDLE_SELECTION_PRICE =>
'SELECT *
FROM catalog_product_bundle_selection_price
FROM ${table:catalog_product_bundle_selection_price}
WHERE selection_id = :selection_id
AND parent_product_id = :parent_product_id
AND website_id = :website_id',
SqlStatementKeys::CREATE_PRODUCT_BUNDLE_OPTION =>
'INSERT
INTO catalog_product_bundle_option
INTO ${table:catalog_product_bundle_option}
(parent_id,
required,
position,
Expand All @@ -80,15 +80,15 @@ class SqlStatementRepository extends \TechDivision\Import\Product\Repositories\S
:position,
:type)',
SqlStatementKeys::UPDATE_PRODUCT_BUNDLE_OPTION =>
'UPDATE catalog_product_bundle_option
'UPDATE ${table:catalog_product_bundle_option}
SET parent_id = :parent_id,
required = :required,
position = :position,
type = :type
WHERE option_id = :option_id',
SqlStatementKeys::CREATE_PRODUCT_BUNDLE_OPTION_VALUE =>
'INSERT
INTO catalog_product_bundle_option_value
INTO ${table:catalog_product_bundle_option_value}
(option_id,
parent_product_id,
store_id,
Expand All @@ -99,7 +99,7 @@ class SqlStatementRepository extends \TechDivision\Import\Product\Repositories\S
:title)',
SqlStatementKeys::CREATE_PRODUCT_BUNDLE_SELECTION =>
'INSERT
INTO catalog_product_bundle_selection
INTO ${table:catalog_product_bundle_selection}
(option_id,
parent_product_id,
product_id,
Expand All @@ -119,7 +119,7 @@ class SqlStatementRepository extends \TechDivision\Import\Product\Repositories\S
:selection_qty,
:selection_can_change_qty)',
SqlStatementKeys::UPDATE_PRODUCT_BUNDLE_SELECTION =>
'UPDATE catalog_product_bundle_selection
'UPDATE ${table:catalog_product_bundle_selection}
SET option_id = :option_id,
parent_product_id = :parent_product_id,
product_id = :product_id,
Expand All @@ -132,7 +132,7 @@ class SqlStatementRepository extends \TechDivision\Import\Product\Repositories\S
WHERE selection_id = :selection_id',
SqlStatementKeys::CREATE_PRODUCT_BUNDLE_SELECTION_PRICE =>
'INSERT
INTO catalog_product_bundle_selection_price
INTO ${table:catalog_product_bundle_selection_price}
(selection_id,
parent_product_id,
website_id,
Expand All @@ -144,7 +144,7 @@ class SqlStatementRepository extends \TechDivision\Import\Product\Repositories\S
:selection_price_type,
:selection_price_value)',
SqlStatementKeys::UPDATE_PRODUCT_BUNDLE_SELECTION_PRICE =>
'UPDATE catalog_product_bundle_selection_price
'UPDATE ${table:catalog_product_bundle_selection_price}
SET selection_price_type = :selection_price_type,
selection_price_value = :selection_price_value
WHERE selection_id = :selection_id
Expand All @@ -153,14 +153,17 @@ class SqlStatementRepository extends \TechDivision\Import\Product\Repositories\S
);

/**
* 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)
{

// merge the class statements
foreach ($this->statements as $key => $statement) {
$this->preparedStatements[$key] = $statement;
}
// pass primary key + table prefix utility to parent instance
parent::__construct($compilers);

// compile the SQL statements
$this->compile($this->statements);
}
}
4 changes: 3 additions & 1 deletion symfony/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

<services>

<service id="import_product_bundle.repository.sql.statement" class="TechDivision\Import\Product\Bundle\Repositories\SqlStatementRepository"/>
<service id="import_product_bundle.repository.sql.statement" class="TechDivision\Import\Product\Bundle\Repositories\SqlStatementRepository">
<argument type="service" id="import.util.sql.compilers"/>
</service>
<service id="import_product_bundle.repository.bundle.option" class="TechDivision\Import\Product\Bundle\Repositories\BundleOptionRepository">
<argument type="service" id="connection"/>
<argument type="service" id="import_product_bundle.repository.sql.statement"/>
Expand Down

0 comments on commit ee31b94

Please sign in to comment.