Пример #1
0
 /**
  * @param SearchResults $list
  * @param array $fields
  * @return array
  * @throws NotFoundException
  */
 private function getRequestedFields(SearchResults $list, array $fields)
 {
     $requestedData = [];
     foreach ($list->getItems() as $key => $item) {
         foreach (array_keys($fields) as $fieldName) {
             if (!isset($item[$fieldName])) {
                 throw new NotFoundException(__("Field {$fieldName} not found"));
             }
             $requestedData[$key][$fieldName] = $item[$fieldName];
         }
     }
     return $requestedData;
 }
Пример #2
0
 /**
  * Get items
  *
  * @return \Magento\Catalog\Api\Data\ProductLinkInterface[]
  */
 public function getItems()
 {
     return parent::getItems();
 }