From 4c576f43da6cf8db9b1edac31e5eda3750545249 Mon Sep 17 00:00:00 2001 From: Tibor Kotosz Date: Thu, 1 Jun 2017 14:20:02 +0200 Subject: [PATCH] Return array of pages as items instead of array of arrays Based on `PageSearchResultsInterface` the getItems() should return `\Magento\Cms\Api\Data\PageInterface[]`. --- app/code/Magento/Cms/Model/PageRepository.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/app/code/Magento/Cms/Model/PageRepository.php b/app/code/Magento/Cms/Model/PageRepository.php index 033289bf8fb8e..521a975c885dd 100644 --- a/app/code/Magento/Cms/Model/PageRepository.php +++ b/app/code/Magento/Cms/Model/PageRepository.php @@ -157,25 +157,10 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $criteria $this->collectionProcessor->process($criteria, $collection); - $pages = []; - /** @var Page $pageModel */ - foreach ($collection as $pageModel) { - $pageData = $this->dataPageFactory->create(); - $this->dataObjectHelper->populateWithArray( - $pageData, - $pageModel->getData(), - \Magento\Cms\Api\Data\PageInterface::class - ); - $pages[] = $this->dataObjectProcessor->buildOutputDataArray( - $pageData, - \Magento\Cms\Api\Data\PageInterface::class - ); - } - /** @var Data\PageSearchResultsInterface $searchResults */ $searchResults = $this->searchResultsFactory->create(); $searchResults->setSearchCriteria($criteria); - $searchResults->setItems($pages); + $searchResults->setItems($collection->getItems()); $searchResults->setTotalCount($collection->getSize()); return $searchResults; }