Skip to content

Commit 14de170

Browse files
committed
MAGETWO-99091: Name of categories in the Category tree on Product Edit page is not displayed according to the selected store view scope
- Added strict types declaration - Added scalar type hints for new methods
1 parent 8d11456 commit 14de170

File tree

1 file changed

+6
-4
lines changed
  • app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier

1 file changed

+6
-4
lines changed

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Catalog\Ui\DataProvider\Product\Form\Modifier;
79

810
use Magento\Catalog\Model\Locator\LocatorInterface;
@@ -313,7 +315,7 @@ protected function customizeCategoriesField(array $meta)
313315
*/
314316
protected function getCategoriesTree($filter = null)
315317
{
316-
$storeId = $this->locator->getStore()->getId();
318+
$storeId = (int) $this->locator->getStore()->getId();
317319

318320
$cachedCategoriesTree = $this->getCacheManager()
319321
->load($this->getCategoriesTreeCacheId($storeId, (string) $filter));
@@ -345,7 +347,7 @@ protected function getCategoriesTree($filter = null)
345347
* @param string $filter
346348
* @return string
347349
*/
348-
private function getCategoriesTreeCacheId($storeId, $filter = '')
350+
private function getCategoriesTreeCacheId(int $storeId, string $filter = '') : string
349351
{
350352
return self::CATEGORY_TREE_ID
351353
. '_' . (string) $storeId
@@ -360,7 +362,7 @@ private function getCategoriesTreeCacheId($storeId, $filter = '')
360362
* @return array
361363
* @throws LocalizedException
362364
*/
363-
private function retrieveShownCategoriesIds($storeId, $filter = '')
365+
private function retrieveShownCategoriesIds(int $storeId, string $filter = '') : array
364366
{
365367
/* @var $matchingNamesCollection \Magento\Catalog\Model\ResourceModel\Category\Collection */
366368
$matchingNamesCollection = $this->categoryCollectionFactory->create();
@@ -396,7 +398,7 @@ private function retrieveShownCategoriesIds($storeId, $filter = '')
396398
* @return array
397399
* @throws LocalizedException
398400
*/
399-
private function retrieveCategoriesTree($storeId, array $shownCategoriesIds = [])
401+
private function retrieveCategoriesTree(int $storeId, array $shownCategoriesIds) : array
400402
{
401403
/* @var $collection \Magento\Catalog\Model\ResourceModel\Category\Collection */
402404
$collection = $this->categoryCollectionFactory->create();

0 commit comments

Comments
 (0)