Skip to content

Commit 4d7c4de

Browse files
author
Oleksii Korshenko
committed
MAGETWO-69805: Return array of blocks as items instead of array of arrays #9157
- Merge Pull Request #9157 from tkotosz/magento2:patch-1
2 parents d844e31 + 27f540c commit 4d7c4de

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

app/code/Magento/Cms/Model/BlockRepository.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -154,25 +154,10 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $criteria
154154

155155
$this->collectionProcessor->process($criteria, $collection);
156156

157-
$blocks = [];
158-
/** @var Block $blockModel */
159-
foreach ($collection as $blockModel) {
160-
$blockData = $this->dataBlockFactory->create();
161-
$this->dataObjectHelper->populateWithArray(
162-
$blockData,
163-
$blockModel->getData(),
164-
\Magento\Cms\Api\Data\BlockInterface::class
165-
);
166-
$blocks[] = $this->dataObjectProcessor->buildOutputDataArray(
167-
$blockData,
168-
\Magento\Cms\Api\Data\BlockInterface::class
169-
);
170-
}
171-
172157
/** @var Data\BlockSearchResultsInterface $searchResults */
173158
$searchResults = $this->searchResultsFactory->create();
174159
$searchResults->setSearchCriteria($criteria);
175-
$searchResults->setItems($blocks);
160+
$searchResults->setItems($collection->getItems());
176161
$searchResults->setTotalCount($collection->getSize());
177162
return $searchResults;
178163
}

0 commit comments

Comments
 (0)