Skip to content

Commit

Permalink
Return array of pages as items instead of array of arrays
Browse files Browse the repository at this point in the history
Based on `PageSearchResultsInterface` the getItems() should return `\Magento\Cms\Api\Data\PageInterface[]`.
  • Loading branch information
Tibor Kotosz authored Jun 1, 2017
1 parent cd4d690 commit 4c576f4
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions app/code/Magento/Cms/Model/PageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 4c576f4

Please sign in to comment.