12 use Magento\Cms\Model\ResourceModel\Block\CollectionFactory as BlockCollectionFactory;
65 private $storeManager;
70 private $collectionProcessor;
102 $this->collectionProcessor = $collectionProcessor ?: $this->getCollectionProcessor();
114 if (empty(
$block->getStoreId())) {
115 $block->setStoreId($this->storeManager->getStore()->getId());
119 $this->resource->save(
$block);
120 }
catch (\Exception $exception) {
135 $block = $this->blockFactory->create();
136 $this->resource->load(
$block, $blockId);
151 public function getList(\
Magento\Framework\Api\SearchCriteriaInterface $criteria)
154 $collection = $this->blockCollectionFactory->create();
156 $this->collectionProcessor->process($criteria,
$collection);
159 $searchResults = $this->searchResultsFactory->create();
160 $searchResults->setSearchCriteria($criteria);
162 $searchResults->setTotalCount(
$collection->getSize());
163 return $searchResults;
173 public function delete(Data\BlockInterface
$block)
176 $this->resource->delete(
$block);
177 }
catch (\Exception $exception) {
193 return $this->
delete($this->
getById($blockId));
202 private function getCollectionProcessor()
204 if (!$this->collectionProcessor) {
206 'Magento\Cms\Model\Api\SearchCriteria\BlockCollectionProcessor' 209 return $this->collectionProcessor;
getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
save(Data\BlockInterface $block)
__construct(ResourceBlock $resource, BlockFactory $blockFactory, \Magento\Cms\Api\Data\BlockInterfaceFactory $dataBlockFactory, BlockCollectionFactory $blockCollectionFactory, Data\BlockSearchResultsInterfaceFactory $searchResultsFactory, DataObjectHelper $dataObjectHelper, DataObjectProcessor $dataObjectProcessor, StoreManagerInterface $storeManager, CollectionProcessorInterface $collectionProcessor=null)