Skip to content

Commit

Permalink
Merge branch 'Fixed-218' of github.com:ronak2ram/graphql-ce into Fixe…
Browse files Browse the repository at this point in the history
…d-218
  • Loading branch information
Valeriy Nayda committed Nov 22, 2018
2 parents 60f91ee + 4eac0fc commit 5c6f20f
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 5c6f20f

Please sign in to comment.