@@ -17,18 +17,26 @@ class Bundle extends \Magento\Framework\Model\Resource\Db\AbstractDb
17
17
*/
18
18
protected $ _productRelation ;
19
19
20
+ /**
21
+ * @var \Magento\Quote\Model\Resource\Quote
22
+ */
23
+ protected $ quoteResource ;
24
+
20
25
/**
21
26
* @param \Magento\Framework\Model\Resource\Db\Context $context
22
27
* @param \Magento\Catalog\Model\Resource\Product\Relation $productRelation
23
- * @param string|null $resourcePrefix
28
+ * @param \Magento\Quote\Model\Resource\Quote $quoteResource
29
+ * @param null $resourcePrefix
24
30
*/
25
31
public function __construct (
26
32
\Magento \Framework \Model \Resource \Db \Context $ context ,
27
33
\Magento \Catalog \Model \Resource \Product \Relation $ productRelation ,
34
+ \Magento \Quote \Model \Resource \Quote $ quoteResource ,
28
35
$ resourcePrefix = null
29
36
) {
30
37
parent ::__construct ($ context , $ resourcePrefix );
31
38
$ this ->_productRelation = $ productRelation ;
39
+ $ this ->quoteResource = $ quoteResource ;
32
40
}
33
41
34
42
/**
@@ -85,7 +93,8 @@ public function getSelectionsData($productId)
85
93
*/
86
94
public function dropAllQuoteChildItems ($ productId )
87
95
{
88
- $ quoteItemIds = $ this ->_getReadAdapter ()->fetchCol (
96
+ $ adapter = $ this ->quoteResource ->getReadConnection ()->select ()->getAdapter ();
97
+ $ quoteItemIds = $ adapter ->fetchCol (
89
98
$ this ->_getReadAdapter ()->select ()->from (
90
99
$ this ->getTable ('quote_item ' ),
91
100
['item_id ' ]
@@ -96,7 +105,7 @@ public function dropAllQuoteChildItems($productId)
96
105
);
97
106
98
107
if ($ quoteItemIds ) {
99
- $ this -> _getWriteAdapter () ->delete (
108
+ $ adapter ->delete (
100
109
$ this ->getTable ('quote_item ' ),
101
110
['parent_item_id IN(?) ' => $ quoteItemIds ]
102
111
);
0 commit comments