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


PHP Mage_ImportExport_Model_Config::getModels方法代码示例

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


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

示例1: _getEntityAdapter

 /**
  * Create instance of entity adapter and return it
  *
  * @throws Mage_Core_Exception
  * @return Mage_ImportExport_Model_Import_Entity_Abstract|Mage_ImportExport_Model_Import_EntityAbstract
  */
 protected function _getEntityAdapter()
 {
     if (!$this->_entityAdapter) {
         $entityTypes = Mage_ImportExport_Model_Config::getModels(self::CONFIG_KEY_ENTITIES);
         if (isset($entityTypes[$this->getEntity()])) {
             try {
                 $this->_entityAdapter = Mage::getModel($entityTypes[$this->getEntity()]['model']);
             } catch (Exception $e) {
                 Mage::logException($e);
                 Mage::throwException(Mage::helper('Mage_ImportExport_Helper_Data')->__('Invalid entity model'));
             }
             if (!$this->_entityAdapter instanceof Mage_ImportExport_Model_Import_Entity_Abstract && !$this->_entityAdapter instanceof Mage_ImportExport_Model_Import_EntityAbstract) {
                 Mage::throwException(Mage::helper('Mage_ImportExport_Helper_Data')->__('Entity adapter object must be an instance of %s or %s', 'Mage_ImportExport_Model_Import_Entity_Abstract', 'Mage_ImportExport_Model_Import_EntityAbstract'));
             }
             // check for entity codes integrity
             if ($this->getEntity() != $this->_entityAdapter->getEntityTypeCode()) {
                 Mage::throwException(Mage::helper('Mage_ImportExport_Helper_Data')->__('Input entity code is not equal to entity adapter code'));
             }
         } else {
             Mage::throwException(Mage::helper('Mage_ImportExport_Helper_Data')->__('Invalid entity'));
         }
         $this->_entityAdapter->setParameters($this->getData());
     }
     return $this->_entityAdapter;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:31,代码来源:Import.php

示例2: getNewWriteInstance

 public function getNewWriteInstance($destinationFile, $fileFormat)
 {
     $validWriters = Mage_ImportExport_Model_Config::getModels(self::CONFIG_KEY_FORMATS);
     if (isset($validWriters[$fileFormat])) {
         try {
             if (file_exists($destinationFile)) {
                 unlink($destinationFile);
             }
             $writer = Mage::getModel($validWriters[$fileFormat]['model'], $destinationFile);
         } catch (Exception $e) {
             Mage::logException($e);
             Mage::throwException(Mage::helper('importexport')->__('Invalid entity model'));
         }
         if (!$writer instanceof Mage_ImportExport_Model_Export_Adapter_Abstract) {
             Mage::throwException(Mage::helper('importexport')->__('Adapter object must be an instance of %s', 'Mage_ImportExport_Model_Export_Adapter_Abstract'));
         }
     } else {
         Mage::throwException(Mage::helper('importexport')->__('Invalid file format'));
     }
     return $writer;
 }
开发者ID:tschifftner,项目名称:Magento-MEP,代码行数:21,代码来源:Data.php

示例3: setEntityTypeCode

 /**
  * Valdiates and sets the entity type.
  *
  * @param string $entityTypeCode
  * @return Danslo_ApiImport_Model_Resource_Import_Data
  */
 public function setEntityTypeCode($entityTypeCode)
 {
     $allowedEntities = array_keys(Mage_ImportExport_Model_Config::getModels(Danslo_ApiImport_Model_Import::CONFIG_KEY_ENTITIES));
     if (!in_array($entityTypeCode, $allowedEntities)) {
         Mage::throwException('Specified entity type (%s) is not in allowed entity types: %s', $entityTypeCode, implode(', ', $allowedEntities));
     }
     $this->_entityTypeCode = $entityTypeCode;
     return $this;
 }
开发者ID:gaileverett,项目名称:ApiImport,代码行数:15,代码来源:Data.php

示例4: _getWriter

 /**
  * Get writer object.
  *
  * @throws Mage_Core_Exception
  * @return Mage_ImportExport_Model_Export_Adapter_Abstract
  */
 protected function _getWriter()
 {
     if (!$this->_writer) {
         $validWriters = Mage_ImportExport_Model_Config::getModels(self::CONFIG_KEY_FORMATS);
         if (isset($validWriters[$this->getFileFormat()])) {
             try {
                 $this->_writer = Mage::getModel($validWriters[$this->getFileFormat()]['model']);
             } catch (Exception $e) {
                 Mage::logException($e);
                 Mage::throwException(Mage::helper('importexport')->__('Invalid entity model'));
             }
             if (!$this->_writer instanceof Mage_ImportExport_Model_Export_Adapter_Abstract) {
                 Mage::throwException(Mage::helper('importexport')->__('Adapter object must be an instance of %s', 'Mage_ImportExport_Model_Export_Adapter_Abstract'));
             }
         } else {
             Mage::throwException(Mage::helper('importexport')->__('Invalid file format'));
         }
     }
     return $this->_writer;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:26,代码来源:Export.php

示例5: dryrunCategoryImport

 /**
  * Import products
  *
  * @param array       $data
  * @param string|null $behavior
  *
  * @return AvS_FastSimpleImport_Model_Import
  */
 public function dryrunCategoryImport($data, $behavior = NULL)
 {
     $transport = new Varien_Object(array('import_data' => $data));
     Mage::dispatchEvent('fastsimpleimport_dryrun_categories_before', array('import_data' => $transport));
     $data = $transport->getImportData();
     if (!is_null($behavior)) {
         $this->setBehavior($behavior);
     }
     $this->setUseNestedArrays(false);
     $this->setEntity(Mage_Catalog_Model_Category::ENTITY);
     /** @var $entityAdapter AvS_FastSimpleImport_Model_Import_Entity_Category */
     $validTypes = Mage_ImportExport_Model_Config::getModels(Mage_ImportExport_Model_Import::CONFIG_KEY_ENTITIES);
     $entityAdapter = Mage::getModel($validTypes[$this->getEntity()]['model']);
     $entityAdapter->setBehavior($this->getBehavior());
     $entityAdapter->setErrorLimit($this->getErrorLimit());
     $entityAdapter->setIgnoreDuplicates($this->getIgnoreDuplicates());
     $entityAdapter->setUnsetEmptyFields($this->getUnsetEmptyFields());
     $entityAdapter->setSymbolEmptyFields($this->getSymbolEmptyFields());
     $entityAdapter->setSymbolIgnoreFields($this->getSymbolIgnoreFields());
     $this->setEntityAdapter($entityAdapter);
     $validationResult = $this->validateSource($data);
     return $validationResult;
 }
开发者ID:tinchodev,项目名称:AvS_FastSimpleImport,代码行数:31,代码来源:Import.php


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