Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Switch to latest techdivision/import-attribute version 17.*
  • Loading branch information
wagnert committed Sep 18, 2019
1 parent 7e21274 commit c402eeb
Show file tree
Hide file tree
Showing 4 changed files with 33 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 12.0.0

## Bugfixes

* None

## Features

* Add techdivision/import-cli-simple#216
* Switch to latest techdivision/import-attribute version 17.*

# Version 11.0.0

## Bugfixes
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "OSL-3.0",
"require": {
"php": ">=5.6.0",
"techdivision/import-attribute": "16.*"
"techdivision/import-attribute": "17.x-dev"
},
"require-dev": {
"doctrine/dbal": "2.5.*",
Expand Down
36 changes: 18 additions & 18 deletions src/Repositories/SqlStatementRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SqlStatementRepository extends \TechDivision\Import\Attribute\Repositories
private $statements = array(
SqlStatementKeys::CREATE_ATTRIBUTE_SET =>
'INSERT
INTO eav_attribute_set
INTO ${table:eav_attribute_set}
(entity_type_id,
attribute_set_name,
sort_order)
Expand All @@ -51,7 +51,7 @@ class SqlStatementRepository extends \TechDivision\Import\Attribute\Repositories
:sort_order)',
SqlStatementKeys::CREATE_ATTRIBUTE_GROUP =>
'INSERT
INTO eav_attribute_group
INTO ${table:eav_attribute_group}
(attribute_set_id,
attribute_group_name,
sort_order,
Expand All @@ -65,13 +65,13 @@ class SqlStatementRepository extends \TechDivision\Import\Attribute\Repositories
:attribute_group_code,
:tab_group_code)',
SqlStatementKeys::UPDATE_ATTRIBUTE_SET =>
'UPDATE eav_attribute_set
'UPDATE ${table:eav_attribute_set}
SET entity_type_id = :entity_type_id,
attribute_set_name = :attribute_set_name,
sort_order = :sort_order
WHERE attribute_set_id = :attribute_set_id',
SqlStatementKeys::UPDATE_ATTRIBUTE_GROUP =>
'UPDATE eav_attribute_group
'UPDATE ${table:eav_attribute_group}
SET attribute_set_id = :attribute_set_id,
attribute_group_name = :attribute_group_name,
sort_order = :sort_order,
Expand All @@ -80,39 +80,39 @@ class SqlStatementRepository extends \TechDivision\Import\Attribute\Repositories
tab_group_code = :tab_group_code
WHERE attribute_group_id = :attribute_group_id',
SqlStatementKeys::DELETE_ATTRIBUTE_SET =>
'DELETE FROM eav_attribute_set WHERE attribute_set_id = :attribute_set_id',
'DELETE FROM ${table:eav_attribute_set} WHERE attribute_set_id = :attribute_set_id',
SqlStatementKeys::DELETE_ATTRIBUTE_GROUP =>
'DELETE FROM eav_attribute_group WHERE attribute_group_id = :attribute_group_id',
'DELETE FROM ${table:eav_attribute_group} WHERE attribute_group_id = :attribute_group_id',
SqlStatementKeys::ENTITY_ATTRIBUTES_BY_ATTRIBUTE_GROUP_ID =>
'SELECT *
FROM eav_entity_attribute
FROM ${table:eav_entity_attribute}
WHERE attribute_group_id = :attribute_group_id',
SqlStatementKeys::ENTITY_ATTRIBUTES_BY_ENTITY_TYPE_ID_AND_ATTRIBUTE_SET_NAME =>
'SELECT t0.*
FROM eav_entity_attribute t0
INNER JOIN eav_attribute_set t1
FROM ${table:eav_entity_attribute} t0
INNER JOIN ${table:eav_attribute_set} t1
ON t1.attribute_set_name = :attribute_set_name
AND t1.entity_type_id = :entity_type_id
AND t0.attribute_set_id = t1.attribute_set_id',
SqlStatementKeys::EAV_ATTRIBUTE_GROUP_BY_ATTRIBUTE_SET_ID_AND_ATTRIBUTE_GROUP_CODE =>
'SELECT *
FROM eav_attribute_group
FROM ${table:eav_attribute_group}
WHERE attribute_set_id = :attribute_set_id
AND attribute_group_code = :attribute_group_code'
);

/**
* 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);
}
}
5 changes: 3 additions & 2 deletions symfony/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

<services>

<service id="import_attribute_set.repository.sql.statement" class="TechDivision\Import\Attribute\Set\Repositories\SqlStatementRepository"/>

<service id="import_attribute_set.repository.sql.statement" class="TechDivision\Import\Attribute\Set\Repositories\SqlStatementRepository">
<argument type="service" id="import.util.sql.compilers"/>
</service>
<service id="import_attribute_set.repository.entity.attribute" class="TechDivision\Import\Attribute\Set\Repositories\EntityAttributeRepository">
<argument type="service" id="connection"/>
<argument type="service" id="import_attribute_set.repository.sql.statement"/>
Expand Down

0 comments on commit c402eeb

Please sign in to comment.