15
15
use Magento \Framework \EntityManager \MetadataPool ;
16
16
use Magento \Store \Api \Data \StoreInterface ;
17
17
use Magento \Store \Model \Store ;
18
+ use Magento \Catalog \Model \Product \Visibility ;
18
19
19
20
// phpcs:disable Magento2.Classes.AbstractApi
20
21
/**
@@ -131,6 +132,11 @@ abstract class AbstractAction
131
132
*/
132
133
private $ currentStore ;
133
134
135
+ /**
136
+ * @var Visibility
137
+ */
138
+ private $ visibility ;
139
+
134
140
/**
135
141
* @param ResourceConnection $resource
136
142
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
@@ -145,7 +151,8 @@ public function __construct(
145
151
\Magento \Catalog \Model \Config $ config ,
146
152
QueryGenerator $ queryGenerator = null ,
147
153
MetadataPool $ metadataPool = null ,
148
- TableMaintainer $ tableMaintainer = null
154
+ TableMaintainer $ tableMaintainer = null ,
155
+ Visibility $ visibility = null
149
156
) {
150
157
$ this ->resource = $ resource ;
151
158
$ this ->connection = $ resource ->getConnection ();
@@ -154,6 +161,7 @@ public function __construct(
154
161
$ this ->queryGenerator = $ queryGenerator ?: ObjectManager::getInstance ()->get (QueryGenerator::class);
155
162
$ this ->metadataPool = $ metadataPool ?: ObjectManager::getInstance ()->get (MetadataPool::class);
156
163
$ this ->tableMaintainer = $ tableMaintainer ?: ObjectManager::getInstance ()->get (TableMaintainer::class);
164
+ $ this ->visibility = $ visibility ?: ObjectManager::getInstance ()->get (Visibility::class);
157
165
}
158
166
159
167
/**
@@ -348,7 +356,7 @@ protected function getNonAnchorCategoriesSelect(Store $store)
348
356
\Magento \Catalog \Model \Product \Attribute \Source \Status::STATUS_ENABLED
349
357
)->where (
350
358
$ this ->connection ->getIfNullSql ('cpvs.value ' , 'cpvd.value ' ) . ' IN (?) ' ,
351
- $ this ->config -> getVisibility () ->getVisibleInSiteIds ()
359
+ $ this ->visibility ->getVisibleInSiteIds ()
352
360
)->columns (
353
361
[
354
362
'category_id ' => 'cc.entity_id ' ,
@@ -589,7 +597,7 @@ protected function createAnchorSelect(Store $store)
589
597
\Magento \Catalog \Model \Product \Attribute \Source \Status::STATUS_ENABLED
590
598
)->where (
591
599
$ this ->connection ->getIfNullSql ('cpvs.value ' , 'cpvd.value ' ) . ' IN (?) ' ,
592
- $ this ->config -> getVisibility () ->getVisibleInSiteIds ()
600
+ $ this ->visibility ->getVisibleInSiteIds ()
593
601
)->where (
594
602
$ this ->connection ->getIfNullSql ('ccas.value ' , 'ccad.value ' ) . ' = ? ' ,
595
603
1
@@ -833,7 +841,7 @@ protected function getAllProducts(Store $store)
833
841
\Magento \Catalog \Model \Product \Attribute \Source \Status::STATUS_ENABLED
834
842
)->where (
835
843
$ this ->connection ->getIfNullSql ('cpvs.value ' , 'cpvd.value ' ) . ' IN (?) ' ,
836
- $ this ->config -> getVisibility () ->getVisibleInSiteIds ()
844
+ $ this ->visibility ->getVisibleInSiteIds ()
837
845
)->group (
838
846
'cp.entity_id '
839
847
)->columns (
0 commit comments