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


PHP Type::factory方法代码示例

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


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

示例1: testFactory

 public function testFactory()
 {
     $product = new \Magento\Framework\DataObject();
     $product->setTypeId(\Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE);
     $type = $this->_productType->factory($product);
     $this->assertInstanceOf('\\Magento\\GroupedProduct\\Model\\Product\\Type\\Grouped', $type);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:7,代码来源:GroupedTest.php

示例2: testFactoryReturnsSingleton

 /**
  * @param sring|null $typeId
  * @dataProvider factoryReturnsSingletonDataProvider
  */
 public function testFactoryReturnsSingleton($typeId)
 {
     $product = new \Magento\Framework\DataObject();
     if ($typeId) {
         $product->setTypeId($typeId);
     }
     $type = $this->_productType->factory($product);
     $otherType = $this->_productType->factory($product);
     $this->assertSame($otherType, $type);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:TypeTest.php

示例3: getProductTypeInstance

 /**
  * Retrieve Product Type Instance
  *
  * @param string $typeId
  * @return \Magento\Catalog\Model\Product\Type\AbstractType
  */
 protected function getProductTypeInstance($typeId)
 {
     if (!isset($this->productTypes[$typeId])) {
         $productEmulator = $this->getProductEmulator($typeId);
         $this->productTypes[$typeId] = $this->catalogProductType->factory($productEmulator);
     }
     return $this->productTypes[$typeId];
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:14,代码来源:Full.php

示例4: factory

 /**
  * {@inheritdoc}
  */
 public function factory($product)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'factory');
     if (!$pluginInfo) {
         return parent::factory($product);
     } else {
         return $this->___callPlugins('factory', func_get_args(), $pluginInfo);
     }
 }
开发者ID:HaonanXu,项目名称:der-snack-backup,代码行数:12,代码来源:Interceptor.php

示例5: getProductTypeInstances

 /**
  * Retrieve Product Type Instances
  * as key - type code, value - instance model
  *
  * @return array
  */
 protected function getProductTypeInstances()
 {
     if (empty($this->productTypes)) {
         $productEmulator = new \Magento\Framework\DataObject();
         foreach (array_keys($this->productType->getTypes()) as $typeId) {
             $productEmulator->setTypeId($typeId);
             $this->productTypes[$typeId] = $this->productType->factory($productEmulator);
         }
     }
     return $this->productTypes;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:17,代码来源:StockIndex.php

示例6: _getProductTypeInstances

 /**
  * Retrieve Product Type Instances
  * as key - type code, value - instance model
  *
  * @return array
  */
 protected function _getProductTypeInstances()
 {
     if ($this->_productTypes === null) {
         $this->_productTypes = [];
         $productEmulator = new \Magento\Framework\Object();
         foreach (array_keys($this->_productType->getTypes()) as $typeId) {
             $productEmulator->setTypeId($typeId);
             $this->_productTypes[$typeId] = $this->_productType->factory($productEmulator);
         }
     }
     return $this->_productTypes;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:AbstractAction.php

示例7: getTypeInstance

 /**
  * Retrieve type instance of the product.
  * Type instance implements product type depended logic and is a singleton shared by all products of the same type.
  *
  * @return \Magento\Catalog\Model\Product\Type\AbstractType
  */
 public function getTypeInstance()
 {
     if ($this->_typeInstance === null) {
         $this->_typeInstance = $this->_catalogProductType->factory($this);
     }
     return $this->_typeInstance;
 }
开发者ID:nblair,项目名称:magescotch,代码行数:13,代码来源:Product.php

示例8: save

 /**
  * Save type related data
  *
  * @param \Magento\Catalog\Model\Product $product
  * @return $this
  */
 public function save($product)
 {
     if ($product->dataHasChangedFor('type_id') && $product->getOrigData('type_id')) {
         $oldTypeProduct = clone $product;
         $oldTypeInstance = $this->_catalogProductType->factory($oldTypeProduct->setTypeId($product->getOrigData('type_id')));
         $oldTypeProduct->setTypeInstance($oldTypeInstance);
         $oldTypeInstance->deleteTypeSpecificData($oldTypeProduct);
     }
     return $this;
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:16,代码来源:AbstractType.php


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