当前位置: 首页>>代码示例>>PHP>>正文


PHP JoinProcessorInterface::extractExtensionAttributes方法代码示例

本文整理汇总了PHP中Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface::extractExtensionAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP JoinProcessorInterface::extractExtensionAttributes方法的具体用法?PHP JoinProcessorInterface::extractExtensionAttributes怎么用?PHP JoinProcessorInterface::extractExtensionAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface的用法示例。


在下文中一共展示了JoinProcessorInterface::extractExtensionAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: populateWithArray

 /**
  * Populate data object using data in array format.
  *
  * @param mixed $dataObject
  * @param array $data
  * @param string $interfaceName
  * @return $this
  */
 public function populateWithArray($dataObject, array $data, $interfaceName)
 {
     if ($dataObject instanceof ExtensibleDataInterface) {
         $data = $this->joinProcessor->extractExtensionAttributes(get_class($dataObject), $data);
     }
     $this->_setDataValues($dataObject, $data, $interfaceName);
     return $this;
 }
开发者ID:kid17,项目名称:magento2,代码行数:16,代码来源:DataObjectHelper.php

示例2: _fetchAll

 /**
  * Fetch collection data
  *
  * @param Select $select
  * @return array
  */
 protected function _fetchAll(Select $select)
 {
     $data = $this->_fetchStrategy->fetchAll($select, $this->_bindParams);
     if ($this->extensionAttributesJoinProcessor) {
         foreach ($data as $key => $dataItem) {
             $data[$key] = $this->extensionAttributesJoinProcessor->extractExtensionAttributes($this->_itemObjectClass, $dataItem);
         }
     }
     return $data;
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:16,代码来源:AbstractDb.php

示例3: getList

 /**
  * {@inheritdoc}
  */
 public function getList(SearchCriteriaInterface $searchCriteria)
 {
     $searchResults = $this->searchResultsFactory->create();
     $searchResults->setSearchCriteria($searchCriteria);
     /** @var \Magento\Customer\Model\Resource\Group\Collection $collection */
     $collection = $this->groupFactory->create()->getCollection();
     $groupInterfaceName = 'Magento\\Customer\\Api\\Data\\GroupInterface';
     $this->extensionAttributesJoinProcessor->process($collection, $groupInterfaceName);
     $collection->addTaxClass();
     //Add filters from root filter group to the collection
     /** @var FilterGroup $group */
     foreach ($searchCriteria->getFilterGroups() as $group) {
         $this->addFilterGroupToCollection($group, $collection);
     }
     $sortOrders = $searchCriteria->getSortOrders();
     /** @var \Magento\Framework\Api\SortOrder $sortOrder */
     if ($sortOrders) {
         foreach ($searchCriteria->getSortOrders() as $sortOrder) {
             $field = $this->translateField($sortOrder->getField());
             $collection->addOrder($field, $sortOrder->getDirection() == SearchCriteriaInterface::SORT_ASC ? 'ASC' : 'DESC');
         }
     } else {
         // set a default sorting order since this method is used constantly in many
         // different blocks
         $field = $this->translateField('id');
         $collection->addOrder($field, 'ASC');
     }
     $collection->setCurPage($searchCriteria->getCurrentPage());
     $collection->setPageSize($searchCriteria->getPageSize());
     /** @var \Magento\Customer\Api\Data\GroupInterface[] $groups */
     $groups = [];
     /** @var \Magento\Customer\Model\Group $group */
     foreach ($collection as $group) {
         /** @var \Magento\Customer\Api\Data\GroupInterface $groupDataObject */
         $groupDataObject = $this->groupDataFactory->create()->setId($group->getId())->setCode($group->getCode())->setTaxClassId($group->getTaxClassId())->setTaxClassName($group->getTaxClassName());
         $data = $group->getData();
         $data = $this->extensionAttributesJoinProcessor->extractExtensionAttributes($groupInterfaceName, $data);
         if (isset($data[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]) && $data[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY] instanceof GroupExtensionInterface) {
             $groupDataObject->setExtensionAttributes($data[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]);
         }
         $groups[] = $groupDataObject;
     }
     $searchResults->setTotalCount($collection->getSize());
     return $searchResults->setItems($groups);
 }
开发者ID:nja78,项目名称:magento2,代码行数:48,代码来源:GroupRepository.php


注:本文中的Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface::extractExtensionAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。