Skip to content

Commit

Permalink
Added warning log
Browse files Browse the repository at this point in the history
  • Loading branch information
ronak2ram committed Oct 26, 2018
1 parent bf0030f commit 4eac0fc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/code/Magento/CmsGraphQl/Model/Resolver/Blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 4eac0fc

Please sign in to comment.