Skip to content

Commit

Permalink
Code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
romainruaud committed Nov 27, 2024
1 parent 92574fc commit 5b01fee
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class Ajax extends \Magento\Framework\App\Action\Action
*/
private $categoryRepository;

/**
* @var \Psr\Log\LoggerInterface
*/
private $logger;

/**
* Constructor.
*
Expand All @@ -61,6 +66,7 @@ public function __construct(
\Magento\Framework\Controller\Result\JsonFactory $jsonResultFactory,
\Magento\Catalog\Model\Layer\Resolver $layerResolver,
\Magento\Catalog\Api\CategoryRepositoryInterfaceFactory $categoryRepository,
\Psr\Log\LoggerInterface $logger,
$filterListPool = []
) {
parent::__construct($context);
Expand All @@ -69,6 +75,7 @@ public function __construct(
$this->layerResolver = $layerResolver;
$this->filterListPool = $filterListPool;
$this->categoryRepository = $categoryRepository;
$this->logger = $logger;
}

/**
Expand Down Expand Up @@ -117,9 +124,8 @@ private function initLayer()
);

$this->layerResolver->get()->setCurrentCategory($category);
} catch (\NoSuchEntityException $exception) {
$logger = $this->_objectManager->get(\Psr\Log\LoggerInterface::class);
$logger->critical($exception->getMessage());
} catch (\Magento\Framework\Exception\NoSuchEntityException $exception) {
$this->logger->critical($exception->getMessage());
}
}

Expand Down

0 comments on commit 5b01fee

Please sign in to comment.