コード例 #1
0
 /**
  * Load customer group collection data from service
  *
  * @param bool $printQuery
  * @param bool $logQuery
  * @return $this
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function loadData($printQuery = false, $logQuery = false)
 {
     if (!$this->isLoaded()) {
         $searchCriteria = $this->getSearchCriteria();
         $searchResults = $this->groupRepository->getList($searchCriteria);
         $this->_totalRecords = $searchResults->getTotalCount();
         /** @var GroupInterface[] $groups */
         $groups = $searchResults->getItems();
         foreach ($groups as $group) {
             $groupItem = new \Magento\Framework\DataObject();
             $groupItem->addData($this->simpleDataObjectConverter->toFlatArray($group, '\\Magento\\Customer\\Api\\Data\\GroupInterface'));
             $this->_addItem($groupItem);
         }
         $this->_setIsLoaded();
     }
     return $this;
 }