|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* TechDivision\Import\Product\Bundle\Ee\Repositories\SqlStatementRepository |
|
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-bundle-ee |
|
18
|
|
|
* @link http://www.techdivision.com |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Product\Bundle\Ee\Repositories; |
|
22
|
|
|
|
|
23
|
|
|
use TechDivision\Import\Product\Bundle\Ee\Utils\SqlStatementKeys; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Repository class with the SQL statements to use. |
|
27
|
|
|
* |
|
28
|
|
|
* @author Tim Wagner <[email protected]> |
|
29
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
|
30
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
31
|
|
|
* @link https://github.com/techdivision/import-product-bundle-ee |
|
32
|
|
|
* @link http://www.techdivision.com |
|
33
|
|
|
*/ |
|
34
|
|
|
class SqlStatementRepository extends \TechDivision\Import\Product\Bundle\Repositories\SqlStatementRepository |
|
35
|
|
|
{ |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* The SQL statements. |
|
39
|
|
|
* |
|
40
|
|
|
* @var array |
|
41
|
|
|
*/ |
|
42
|
|
|
private $statements = array( |
|
|
|
|
|
|
43
|
|
|
SqlStatementKeys::CREATE_SEQUENCE_PRODUCT_BUNDLE_OPTION => |
|
44
|
|
|
'INSERT INTO ${table:sequence_product_bundle_option} VALUES ()', |
|
45
|
|
|
SqlStatementKeys::CREATE_SEQUENCE_PRODUCT_BUNDLE_SELECTION => |
|
46
|
|
|
'INSERT INTO ${table:sequence_product_bundle_selection} VALUES ()', |
|
47
|
|
|
SqlStatementKeys::UPDATE_PRODUCT_BUNDLE_OPTION => |
|
48
|
|
|
'UPDATE ${table:catalog_product_bundle_option} |
|
49
|
|
|
SET ${column-values:catalog_product_bundle_option} |
|
50
|
|
|
WHERE option_id = :option_id |
|
51
|
|
|
AND parent_id = :parent_id', |
|
52
|
|
|
SqlStatementKeys::UPDATE_PRODUCT_BUNDLE_SELECTION => |
|
53
|
|
|
'UPDATE ${table:catalog_product_bundle_selection} |
|
54
|
|
|
SET ${column-values:catalog_product_bundle_selection} |
|
55
|
|
|
WHERE selection_id = :selection_id |
|
56
|
|
|
AND parent_product_id = :parent_product_id', |
|
57
|
|
|
); |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Initializes the SQL statement repository with the primary key and table prefix utility. |
|
61
|
|
|
* |
|
62
|
|
|
* @param \IteratorAggregate<\TechDivision\Import\Utils\SqlCompilerInterface> $compilers The array with the compiler instances |
|
|
|
|
|
|
63
|
|
|
*/ |
|
64
|
|
|
public function __construct(\IteratorAggregate $compilers) |
|
65
|
|
|
{ |
|
66
|
|
|
|
|
67
|
|
|
// pass primary key + table prefix utility to parent instance |
|
68
|
|
|
parent::__construct($compilers); |
|
|
|
|
|
|
69
|
|
|
|
|
70
|
|
|
// compile the SQL statements |
|
71
|
|
|
$this->compile($this->statements); |
|
|
|
|
|
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|