From 4eac0fce975759e961793d88c77d35f61bd9d94e Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 26 Oct 2018 13:06:44 +0530 Subject: [PATCH] Added warning log --- .../Magento/CmsGraphQl/Model/Resolver/Blocks.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CmsGraphQl/Model/Resolver/Blocks.php b/app/code/Magento/CmsGraphQl/Model/Resolver/Blocks.php index d7c0008c7d927..fabb479763e60 100644 --- a/app/code/Magento/CmsGraphQl/Model/Resolver/Blocks.php +++ b/app/code/Magento/CmsGraphQl/Model/Resolver/Blocks.php @@ -14,6 +14,7 @@ use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Psr\Log\LoggerInterface; /** * CMS blocks field resolver, used for GraphQL request processing @@ -25,13 +26,20 @@ class Blocks implements ResolverInterface */ private $blockDataProvider; + /** + * @var LoggerInterface + */ + private $logger; + /** * @param BlockDataProvider $blockDataProvider */ public function __construct( - BlockDataProvider $blockDataProvider + BlockDataProvider $blockDataProvider, + LoggerInterface $logger ) { $this->blockDataProvider = $blockDataProvider; + $this->logger = $logger; } /** @@ -81,6 +89,10 @@ private function getBlocksData(array $blockIdentifiers): array $blockData = $this->blockDataProvider->getData($blockIdentifier); if (!empty($blockData)) { $blocksData[$blockIdentifier] = $blockData; + } else { + $this->logger->warning( + sprintf('The CMS block with the "%s" Identifier is disabled.', $blockIdentifier) + ); } } } catch (NoSuchEntityException $e) {