1515use Magento \Framework \EntityManager \MetadataPool ;
1616use Magento \Store \Api \Data \StoreInterface ;
1717use Magento \Store \Model \Store ;
18+ use Magento \Catalog \Model \Product \Visibility ;
1819
1920// phpcs:disable Magento2.Classes.AbstractApi
2021/**
@@ -131,6 +132,11 @@ abstract class AbstractAction
131132 */
132133 private $ currentStore ;
133134
135+ /**
136+ * @var Visibility
137+ */
138+ private $ visibility ;
139+
134140 /**
135141 * @param ResourceConnection $resource
136142 * @param \Magento\Store\Model\StoreManagerInterface $storeManager
@@ -145,7 +151,8 @@ public function __construct(
145151 \Magento \Catalog \Model \Config $ config ,
146152 QueryGenerator $ queryGenerator = null ,
147153 MetadataPool $ metadataPool = null ,
148- TableMaintainer $ tableMaintainer = null
154+ TableMaintainer $ tableMaintainer = null ,
155+ Visibility $ visibility = null
149156 ) {
150157 $ this ->resource = $ resource ;
151158 $ this ->connection = $ resource ->getConnection ();
@@ -154,6 +161,7 @@ public function __construct(
154161 $ this ->queryGenerator = $ queryGenerator ?: ObjectManager::getInstance ()->get (QueryGenerator::class);
155162 $ this ->metadataPool = $ metadataPool ?: ObjectManager::getInstance ()->get (MetadataPool::class);
156163 $ this ->tableMaintainer = $ tableMaintainer ?: ObjectManager::getInstance ()->get (TableMaintainer::class);
164+ $ this ->visibility = $ visibility ?: ObjectManager::getInstance ()->get (Visibility::class);
157165 }
158166
159167 /**
@@ -348,7 +356,7 @@ protected function getNonAnchorCategoriesSelect(Store $store)
348356 \Magento \Catalog \Model \Product \Attribute \Source \Status::STATUS_ENABLED
349357 )->where (
350358 $ this ->connection ->getIfNullSql ('cpvs.value ' , 'cpvd.value ' ) . ' IN (?) ' ,
351- $ this ->config -> getVisibility () ->getVisibleInSiteIds ()
359+ $ this ->visibility ->getVisibleInSiteIds ()
352360 )->columns (
353361 [
354362 'category_id ' => 'cc.entity_id ' ,
@@ -589,7 +597,7 @@ protected function createAnchorSelect(Store $store)
589597 \Magento \Catalog \Model \Product \Attribute \Source \Status::STATUS_ENABLED
590598 )->where (
591599 $ this ->connection ->getIfNullSql ('cpvs.value ' , 'cpvd.value ' ) . ' IN (?) ' ,
592- $ this ->config -> getVisibility () ->getVisibleInSiteIds ()
600+ $ this ->visibility ->getVisibleInSiteIds ()
593601 )->where (
594602 $ this ->connection ->getIfNullSql ('ccas.value ' , 'ccad.value ' ) . ' = ? ' ,
595603 1
@@ -833,7 +841,7 @@ protected function getAllProducts(Store $store)
833841 \Magento \Catalog \Model \Product \Attribute \Source \Status::STATUS_ENABLED
834842 )->where (
835843 $ this ->connection ->getIfNullSql ('cpvs.value ' , 'cpvd.value ' ) . ' IN (?) ' ,
836- $ this ->config -> getVisibility () ->getVisibleInSiteIds ()
844+ $ this ->visibility ->getVisibleInSiteIds ()
837845 )->group (
838846 'cp.entity_id '
839847 )->columns (
0 commit comments