Newer
Older

Eduarda Lentz Rodrigues da Silva
committed
<?php
declare(strict_types=1);
namespace Firegento\ContentProvisioning\Model\Query;
use Magento\Framework\App\State;
use Firegento\ContentProvisioning\Api\CmsBlockRepositoryInterface;
class GetCmsBlockByIdentifier
{
private $cmsBlockRepository;
public function __construct(
CmsBlockRepositoryInterface $cmsBlockRepository
) {
$this->cmsBlockRepository = $cmsBlockRepository;
}
protected function execute(string $key)
{
$blockData = $this->cmsBlockRepository->getByIdentifier($key);
if (empty($blockData)) {
throw new NotFoundException(__('Block with key %1 not found.', $key));
}
return $blockData;
}
}