Skip to content

Commit b6f86db

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-74766' into 2.2-develop-pr30
2 parents 8732c99 + 5d39e2d commit b6f86db

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

app/code/Magento/Catalog/Model/Product.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -530,19 +530,6 @@ public function getStoreId()
530530
return $this->_storeManager->getStore()->getId();
531531
}
532532

533-
/**
534-
* Get collection instance
535-
*
536-
* @return object
537-
* @deprecated 101.1.0 because collections should be used directly via factory
538-
*/
539-
public function getResourceCollection()
540-
{
541-
$collection = parent::getResourceCollection();
542-
$collection->setStoreId($this->getStoreId());
543-
return $collection;
544-
}
545-
546533
/**
547534
* Get product url model
548535
*

app/code/Magento/Catalog/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,7 @@
859859
<argument name="customFilters" xsi:type="array">
860860
<item name="category_id" xsi:type="object">Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\FilterProcessor\ProductCategoryFilter</item>
861861
<item name="store" xsi:type="object">Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\FilterProcessor\ProductStoreFilter</item>
862+
<item name="store_id" xsi:type="object">Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\FilterProcessor\ProductStoreFilter</item>
862863
<item name="website_id" xsi:type="object">Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\FilterProcessor\ProductWebsiteFilter</item>
863864
</argument>
864865
</arguments>

dev/tests/integration/testsuite/Magento/Catalog/Model/ProductRepositoryTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ class ProductRepositoryTest extends \PHPUnit\Framework\TestCase
3030
*/
3131
private $productResource;
3232

33+
/**
34+
* @var \Magento\Framework\Api\SearchCriteriaBuilder
35+
*/
36+
private $searchCriteriaBuilder;
37+
3338
/**
3439
* @inheritdoc
3540
*/
@@ -39,6 +44,8 @@ protected function setUp()
3944
->get(ProductRepositoryInterface::class);
4045
$this->productResource = Bootstrap::getObjectManager()
4146
->get(ProductResource::class);
47+
$this->searchCriteriaBuilder = Bootstrap::getObjectManager()
48+
->create(\Magento\Framework\Api\SearchCriteriaBuilder::class);
4249
}
4350

4451
/**
@@ -174,4 +181,21 @@ public function skuDataProvider(): array
174181
['sku' => 'simple ']
175182
];
176183
}
184+
185+
/**
186+
* Checks filtering by store_id.
187+
*
188+
* @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/product_simple.php
189+
* @return void
190+
*/
191+
public function testFilterByStoreId()
192+
{
193+
$searchCriteria = $this->searchCriteriaBuilder
194+
->addFilter('store_id', '1', 'eq')
195+
->create();
196+
$list = $this->productRepository->getList($searchCriteria);
197+
$count = $list->getTotalCount();
198+
199+
$this->assertGreaterThanOrEqual(1, $count);
200+
}
177201
}

0 commit comments

Comments
 (0)