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


PHP ExtensionAttribute\JoinProcessorInterface类代码示例

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


在下文中一共展示了JoinProcessorInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getList

 /**
  * {@inheritdoc}
  */
 public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria)
 {
     $quoteCollection = $this->quoteCollectionFactory->create();
     $this->extensionAttributesJoinProcessor->process($quoteCollection);
     $searchData = $this->searchResultsDataFactory->create();
     $searchData->setSearchCriteria($searchCriteria);
     $searchData->setItems($quoteCollection->getItems());
     return $searchData;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:TestRepository.php

示例3: getList

 /**
  * {@inheritdoc}
  */
 public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria)
 {
     $this->quoteCollection = $this->getQuoteCollection();
     /** @var \Magento\Quote\Api\Data\CartSearchResultsInterface $searchData */
     $searchData = $this->searchResultsDataFactory->create();
     $searchData->setSearchCriteria($searchCriteria);
     foreach ($searchCriteria->getFilterGroups() as $group) {
         $this->addFilterGroupToCollection($group, $this->quoteCollection);
     }
     $searchData->setTotalCount($this->quoteCollection->getSize());
     $sortOrders = $searchCriteria->getSortOrders();
     if ($sortOrders) {
         /** @var SortOrder $sortOrder */
         foreach ($sortOrders as $sortOrder) {
             $this->quoteCollection->addOrder($sortOrder->getField(), $sortOrder->getDirection() == SortOrder::SORT_ASC ? 'ASC' : 'DESC');
         }
     }
     $this->quoteCollection->setCurPage($searchCriteria->getCurrentPage());
     $this->quoteCollection->setPageSize($searchCriteria->getPageSize());
     $this->extensionAttributesJoinProcessor->process($this->quoteCollection);
     foreach ($this->quoteCollection->getItems() as $quote) {
         /** @var CartInterface $quote */
         $this->getLoadHandler()->load($quote);
     }
     $searchData->setItems($this->quoteCollection->getItems());
     return $searchData;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:30,代码来源:QuoteRepository.php

示例4: getItems

 /**
  * @param \Magento\Catalog\Api\Data\ProductInterface $product
  * @return \Magento\Bundle\Api\Data\OptionInterface[]
  */
 public function getItems(\Magento\Catalog\Api\Data\ProductInterface $product)
 {
     $optionCollection = $this->type->getOptionsCollection($product);
     $this->extensionAttributesJoinProcessor->process($optionCollection);
     $optionList = [];
     /** @var \Magento\Bundle\Model\Option $option */
     foreach ($optionCollection as $option) {
         $productLinks = $this->linkList->getItems($product, $option->getOptionId());
         /** @var \Magento\Bundle\Api\Data\OptionInterface $optionDataObject */
         $optionDataObject = $this->optionFactory->create();
         $this->dataObjectHelper->populateWithArray($optionDataObject, $option->getData(), '\\Magento\\Bundle\\Api\\Data\\OptionInterface');
         $optionDataObject->setOptionId($option->getOptionId())->setTitle($option->getTitle() === null ? $option->getDefaultTitle() : $option->getTitle())->setSku($product->getSku())->setProductLinks($productLinks);
         $optionList[] = $optionDataObject;
     }
     return $optionList;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:20,代码来源:OptionList.php

示例5: getList

 /**
  * Retrieve customers addresses matching the specified criteria.
  *
  * @param SearchCriteriaInterface $searchCriteria
  * @return \Magento\Customer\Api\Data\AddressSearchResultsInterface
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function getList(SearchCriteriaInterface $searchCriteria)
 {
     $searchResults = $this->addressSearchResultsFactory->create();
     /** @var Collection $collection */
     $collection = $this->addressCollectionFactory->create();
     $this->extensionAttributesJoinProcessor->process($collection, 'Magento\\Customer\\Api\\Data\\AddressInterface');
     // Add filters from root filter group to the collection
     foreach ($searchCriteria->getFilterGroups() as $group) {
         $this->addFilterGroupToCollection($group, $collection);
     }
     $searchResults->setTotalCount($collection->getSize());
     /** @var SortOrder $sortOrder */
     foreach ((array) $searchCriteria->getSortOrders() as $sortOrder) {
         $field = $sortOrder->getField();
         $collection->addOrder($field, $sortOrder->getDirection() == SearchCriteriaInterface::SORT_ASC ? 'ASC' : 'DESC');
     }
     $collection->setCurPage($searchCriteria->getCurrentPage());
     $collection->setPageSize($searchCriteria->getPageSize());
     /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */
     $addresses = [];
     /** @var \Magento\Customer\Model\Address $address */
     foreach ($collection->getItems() as $address) {
         $addresses[] = $this->getById($address->getId());
     }
     $searchResults->setItems($addresses);
     $searchResults->setSearchCriteria($searchCriteria);
     return $searchResults;
 }
开发者ID:nja78,项目名称:magento2,代码行数:35,代码来源:AddressRepository.php

示例6: testGetListSuccess

 /**
  * @param int $direction
  * @param string $expectedDirection
  * @dataProvider getListSuccessDataProvider
  */
 public function testGetListSuccess($direction, $expectedDirection)
 {
     $searchResult = $this->getMock('\\Magento\\Quote\\Api\\Data\\CartSearchResultsInterface', [], [], '', false);
     $searchCriteriaMock = $this->getMock('\\Magento\\Framework\\Api\\SearchCriteria', [], [], '', false);
     $cartMock = $this->getMock('Magento\\Payment\\Model\\Cart', [], [], '', false);
     $filterMock = $this->getMock('\\Magento\\Framework\\Api\\Filter', [], [], '', false);
     $pageSize = 10;
     $this->searchResultsDataFactory->expects($this->once())->method('create')->will($this->returnValue($searchResult));
     $searchResult->expects($this->once())->method('setSearchCriteria');
     $filterGroupMock = $this->getMock('\\Magento\\Framework\\Api\\Search\\FilterGroup', [], [], '', false);
     $searchCriteriaMock->expects($this->any())->method('getFilterGroups')->will($this->returnValue([$filterGroupMock]));
     //addFilterGroupToCollection() checks
     $filterGroupMock->expects($this->any())->method('getFilters')->will($this->returnValue([$filterMock]));
     $filterMock->expects($this->once())->method('getField')->will($this->returnValue('store_id'));
     $filterMock->expects($this->any())->method('getConditionType')->will($this->returnValue('eq'));
     $filterMock->expects($this->once())->method('getValue')->will($this->returnValue('filter_value'));
     //back in getList()
     $this->quoteCollectionMock->expects($this->once())->method('getSize')->willReturn($pageSize);
     $searchResult->expects($this->once())->method('setTotalCount')->with($pageSize);
     $sortOrderMock = $this->getMockBuilder('Magento\\Framework\\Api\\SortOrder')->setMethods(['getField', 'getDirection'])->disableOriginalConstructor()->getMock();
     //foreach cycle
     $searchCriteriaMock->expects($this->once())->method('getSortOrders')->will($this->returnValue([$sortOrderMock]));
     $sortOrderMock->expects($this->once())->method('getField')->will($this->returnValue('id'));
     $sortOrderMock->expects($this->once())->method('getDirection')->will($this->returnValue($direction));
     $this->quoteCollectionMock->expects($this->once())->method('addOrder')->with('id', $expectedDirection);
     $searchCriteriaMock->expects($this->once())->method('getCurrentPage')->will($this->returnValue(1));
     $searchCriteriaMock->expects($this->once())->method('getPageSize')->will($this->returnValue(10));
     $this->quoteCollectionMock->expects($this->once())->method('setCurPage')->with(1);
     $this->quoteCollectionMock->expects($this->once())->method('setPageSize')->with(10);
     $this->extensionAttributesJoinProcessorMock->expects($this->once())->method('process')->with($this->isInstanceOf('\\Magento\\Quote\\Model\\ResourceModel\\Quote\\Collection'));
     $this->quoteCollectionMock->expects($this->once())->method('getItems')->willReturn([$cartMock]);
     $searchResult->expects($this->once())->method('setItems')->with([$cartMock]);
     $this->assertEquals($searchResult, $this->model->getList($searchCriteriaMock));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:39,代码来源:QuoteRepositoryTest.php

示例7: getList

 /**
  * Retrieve coupon.
  *
  * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
  * @return \Magento\SalesRule\Api\Data\CouponSearchResultInterface
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
 {
     /** @var \Magento\SalesRule\Model\ResourceModel\Coupon\Collection $collection */
     $collection = $this->collectionFactory->create();
     $couponInterfaceName = 'Magento\\SalesRule\\Api\\Data\\CouponInterface';
     $this->extensionAttributesJoinProcessor->process($collection, $couponInterfaceName);
     //Add filters from root filter group to the collection
     /** @var FilterGroup $group */
     foreach ($searchCriteria->getFilterGroups() as $group) {
         $this->addFilterGroupToCollection($group, $collection);
     }
     $sortOrders = $searchCriteria->getSortOrders();
     if ($sortOrders === null) {
         $sortOrders = [];
     }
     /** @var \Magento\Framework\Api\SortOrder $sortOrder */
     foreach ($sortOrders as $sortOrder) {
         $field = $sortOrder->getField();
         $collection->addOrder($field, $sortOrder->getDirection() == SortOrder::SORT_ASC ? 'ASC' : 'DESC');
     }
     $collection->setCurPage($searchCriteria->getCurrentPage());
     $collection->setPageSize($searchCriteria->getPageSize());
     $coupons = [];
     /** @var \Magento\SalesRule\Model\Coupon $couponModel */
     foreach ($collection->getItems() as $couponModel) {
         $coupons[] = $couponModel->getData();
     }
     $searchResults = $this->searchResultFactory->create();
     $searchResults->setSearchCriteria($searchCriteria);
     $searchResults->setItems($coupons);
     $searchResults->setTotalCount($collection->getSize());
     return $searchResults;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:40,代码来源:CouponRepository.php

示例8: getList

 /**
  * {@inheritdoc}
  */
 public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria)
 {
     $searchResults = $this->taxRuleSearchResultsFactory->create();
     $searchResults->setSearchCriteria($searchCriteria);
     $fields = [];
     $collection = $this->collectionFactory->create();
     $this->joinProcessor->process($collection);
     //Add filters from root filter group to the collection
     foreach ($searchCriteria->getFilterGroups() as $group) {
         $this->addFilterGroupToCollection($group, $collection);
         foreach ($group->getFilters() as $filter) {
             $fields[] = $this->translateField($filter->getField());
         }
     }
     if ($fields) {
         if (in_array('cd.customer_tax_class_id', $fields) || in_array('cd.product_tax_class_id', $fields)) {
             $collection->joinCalculationData('cd');
         }
     }
     $searchResults->setTotalCount($collection->getSize());
     $sortOrders = $searchCriteria->getSortOrders();
     /** @var SortOrder $sortOrder */
     if ($sortOrders) {
         foreach ($sortOrders as $sortOrder) {
             $collection->addOrder($this->translateField($sortOrder->getField()), $sortOrder->getDirection() == SearchCriteria::SORT_ASC ? 'ASC' : 'DESC');
         }
     }
     $collection->setCurPage($searchCriteria->getCurrentPage());
     $collection->setPageSize($searchCriteria->getPageSize());
     $searchResults->setItems($collection->getItems());
     return $searchResults;
 }
开发者ID:nja78,项目名称:magento2,代码行数:35,代码来源:TaxRuleRepository.php

示例9: getList

 /**
  * {@inheritdoc}
  */
 public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
 {
     /** @var \Magento\Tax\Model\ResourceModel\Calculation\Rate\Collection $collection */
     $collection = $this->rateFactory->create()->getCollection();
     $this->joinProcessor->process($collection);
     $collection->joinRegionTable();
     //Add filters from root filter group to the collection
     foreach ($searchCriteria->getFilterGroups() as $group) {
         $this->addFilterGroupToCollection($group, $collection);
     }
     $sortOrders = $searchCriteria->getSortOrders();
     /** @var SortOrder $sortOrder */
     if ($sortOrders) {
         foreach ($sortOrders as $sortOrder) {
             $collection->addOrder($this->translateField($sortOrder->getField()), $sortOrder->getDirection() == SortOrder::SORT_ASC ? 'ASC' : 'DESC');
         }
     }
     $collection->setCurPage($searchCriteria->getCurrentPage());
     $collection->setPageSize($searchCriteria->getPageSize());
     $taxRate = [];
     /** @var \Magento\Tax\Model\Calculation\Rate $taxRateModel */
     foreach ($collection as $taxRateModel) {
         $taxRate[] = $taxRateModel;
     }
     return $this->taxRateSearchResultsFactory->create()->setItems($taxRate)->setTotalCount($collection->getSize())->setSearchCriteria($searchCriteria);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:29,代码来源:RateRepository.php

示例10: getSamples

 /**
  * Get downloadable product samples
  *
  * @param \Magento\Catalog\Model\Product $product
  * @return \Magento\Downloadable\Model\Resource\Sample\Collection
  */
 public function getSamples($product)
 {
     if ($product->getDownloadableSamples() === null) {
         $sampleCollection = $this->_samplesFactory->create()->addProductToFilter($product->getId())->addTitleToResult($product->getStoreId());
         $this->extensionAttributesJoinProcessor->process($sampleCollection);
         $product->setDownloadableSamples($sampleCollection);
     }
     return $product->getDownloadableSamples();
 }
开发者ID:nja78,项目名称:magento2,代码行数:15,代码来源:Type.php

示例11: getList

 /**
  * {@inheritdoc}
  */
 public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
 {
     /** @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection $collection */
     $collection = $this->collectionFactory->create();
     $this->joinProcessor->process($collection);
     /** The only possible/meaningful search criteria for attribute set is entity type code */
     $entityTypeCode = $this->getEntityTypeCode($searchCriteria);
     if ($entityTypeCode !== null) {
         $collection->setEntityTypeFilter($this->eavConfig->getEntityType($entityTypeCode)->getId());
     }
     $collection->setCurPage($searchCriteria->getCurrentPage());
     $collection->setPageSize($searchCriteria->getPageSize());
     $searchResults = $this->searchResultsFactory->create();
     $searchResults->setSearchCriteria($searchCriteria);
     $searchResults->setItems($collection->getItems());
     $searchResults->setTotalCount($collection->getSize());
     return $searchResults;
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:21,代码来源:AttributeSetRepository.php

示例12: _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

示例13: getProductOptions

 /**
  * @param int $productId
  * @param int $storeId
  * @param bool $requiredOnly
  * @return \Magento\Catalog\Api\Data\ProductCustomOptionInterface[]
  */
 public function getProductOptions($productId, $storeId, $requiredOnly = false)
 {
     $collection = $this->addFieldToFilter('cpe.entity_id', $productId)->addTitleToResult($storeId)->addPriceToResult($storeId)->setOrder('sort_order', 'asc')->setOrder('title', 'asc');
     if ($requiredOnly) {
         $collection->addRequiredFilter();
     }
     $collection->addValuesToResult($storeId);
     $this->joinProcessor->process($collection);
     return $collection->getItems();
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:16,代码来源:Collection.php

示例14: getList

 /**
  * {@inheritdoc}
  */
 public function getList($entityTypeCode, \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
 {
     if (!$entityTypeCode) {
         throw InputException::requiredField('entity_type_code');
     }
     /** @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection $attributeCollection */
     $attributeCollection = $this->attributeCollectionFactory->create();
     $this->joinProcessor->process($attributeCollection);
     $attributeCollection->addFieldToFilter('entity_type_code', ['eq' => $entityTypeCode]);
     $attributeCollection->join(['entity_type' => $attributeCollection->getTable('eav_entity_type')], 'main_table.entity_type_id = entity_type.entity_type_id', []);
     $attributeCollection->joinLeft(['eav_entity_attribute' => $attributeCollection->getTable('eav_entity_attribute')], 'main_table.attribute_id = eav_entity_attribute.attribute_id', []);
     $entityType = $this->eavConfig->getEntityType($entityTypeCode);
     $additionalTable = $entityType->getAdditionalAttributeTable();
     if ($additionalTable) {
         $attributeCollection->join(['additional_table' => $attributeCollection->getTable($additionalTable)], 'main_table.attribute_id = additional_table.attribute_id', []);
     }
     //Add filters from root filter group to the collection
     foreach ($searchCriteria->getFilterGroups() as $group) {
         $this->addFilterGroupToCollection($group, $attributeCollection);
     }
     /** @var SortOrder $sortOrder */
     foreach ((array) $searchCriteria->getSortOrders() as $sortOrder) {
         $attributeCollection->addOrder($sortOrder->getField(), $sortOrder->getDirection() == SortOrder::SORT_ASC ? 'ASC' : 'DESC');
     }
     $totalCount = $attributeCollection->getSize();
     // Group attributes by id to prevent duplicates with different attribute sets
     $attributeCollection->addAttributeGrouping();
     $attributeCollection->setCurPage($searchCriteria->getCurrentPage());
     $attributeCollection->setPageSize($searchCriteria->getPageSize());
     $attributes = [];
     /** @var \Magento\Eav\Api\Data\AttributeInterface $attribute */
     foreach ($attributeCollection as $attribute) {
         $attributes[] = $this->get($entityTypeCode, $attribute->getAttributeCode());
     }
     $searchResults = $this->searchResultsFactory->create();
     $searchResults->setSearchCriteria($searchCriteria);
     $searchResults->setItems($attributes);
     $searchResults->setTotalCount($totalCount);
     return $searchResults;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:43,代码来源:AttributeRepository.php

示例15: load

 /**
  * @param ProductInterface $product
  * @return OptionInterface[]
  */
 public function load(ProductInterface $product)
 {
     $options = [];
     /** @var Configurable $typeInstance */
     $typeInstance = $product->getTypeInstance();
     $attributeCollection = $typeInstance->getConfigurableAttributeCollection($product);
     $this->extensionAttributesJoinProcessor->process($attributeCollection);
     foreach ($attributeCollection as $attribute) {
         $values = [];
         $attributeOptions = $attribute->getOptions();
         if (is_array($attributeOptions)) {
             foreach ($attributeOptions as $option) {
                 /** @var \Magento\ConfigurableProduct\Api\Data\OptionValueInterface $value */
                 $value = $this->optionValueFactory->create();
                 $value->setValueIndex($option['value_index']);
                 $values[] = $value;
             }
         }
         $attribute->setValues($values);
         $options[] = $attribute;
     }
     return $options;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:27,代码来源:Loader.php


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