8 use Magento\Catalog\Model\ResourceModel\CategoryFactory;
20 private $hashMap = [];
25 private $categoryRepository;
30 private $categoryResourceFactory;
38 CategoryFactory $categoryResourceFactory
41 $this->categoryResourceFactory = $categoryResourceFactory;
52 if (!isset($this->hashMap[$categoryId])) {
53 $category = $this->categoryRepository->get($categoryId);
54 $this->hashMap[$categoryId] = $this->getAllCategoryChildrenIds(
$category);
56 return $this->hashMap[$categoryId];
62 public function getData($categoryId, $key)
64 $categorySpecificData = $this->
getAllData($categoryId);
65 if (isset($categorySpecificData[$key])) {
66 return $categorySpecificData[$key];
79 $categoryResource = $this->categoryResourceFactory->create();
82 ->from($categoryResource->getEntityTable(),
'entity_id')
83 ->where(
$connection->quoteIdentifier(
'path') .
' LIKE :c_path');
84 $bind = [
'c_path' =>
$category->getPath() .
'%'];
93 unset($this->hashMap[$categoryId]);
getData($categoryId, $key)
__construct(CategoryRepository $categoryRepository, CategoryFactory $categoryResourceFactory)