*/ abstract class Mage_Dataflow_Model_Convert_Parser_Abstract extends Mage_Dataflow_Model_Convert_Container_Abstract implements Mage_Dataflow_Model_Convert_Parser_Interface { /** * Dataflow batch model * * @var Mage_Dataflow_Model_Batch */ protected $_batch; /** * Dataflow batch export model * * @var Mage_Dataflow_Model_Batch_Export */ protected $_batchExport; /** * Dataflow batch import model * * @var Mage_Dataflow_Model_Batch_Import */ protected $_batchImport; /** * Count parse rows * * @var int */ protected $_countRows = 0; /** * Retrieve Batch model singleton * * @return Mage_Dataflow_Model_Batch */ public function getBatchModel() { if (is_null($this->_batch)) { $this->_batch = Mage::getSingleton('dataflow/batch'); } return $this->_batch; } /** * Retrieve Batch export model * * @return Mage_Dataflow_Model_Batch_Export */ public function getBatchExportModel() { if (is_null($this->_batchExport)) { $object = Mage::getModel('dataflow/batch_export'); $this->_batchExport = Varien_Object_Cache::singleton()->save($object); } return Varien_Object_Cache::singleton()->load($this->_batchExport); } /** * Retrieve Batch import model * * @return Mage_Dataflow_Model_Import_Export */ public function getBatchImportModel() { if (is_null($this->_batchImport)) { $object = Mage::getModel('dataflow/batch_import'); $this->_batchImport = Varien_Object_Cache::singleton()->save($object); } return Varien_Object_Cache::singleton()->load($this->_batchImport); } protected function _copy($file) { $ioAdapter = new Varien_Io_File(); if (!$ioAdapter->fileExists($file)) { Mage::throwException(Mage::helper('dataflow')->__('File "%s" does not exist.', $file)); } $ioAdapter->setAllowCreateFolders(true); $ioAdapter->createDestinationDir($this->getBatchModel()->getIoAdapter()->getPath()); return $ioAdapter->cp($file, $this->getBatchModel()->getIoAdapter()->getFile(true)); } }