/**
  * Get pattern instance
  *
  * @return \Magento\ToolkitFramework\ImportExport\Fixture\Complex\Pattern
  */
 protected function getPattern()
 {
     if (!$this->_pattern instanceof \Magento\ToolkitFramework\ImportExport\Fixture\Complex\Pattern) {
         $patternData = [['id' => '%s', 'name' => 'Static', 'calculated' => function ($index) {
             return $index * 10;
         }], ['name' => 'xxx %s'], ['name' => 'yyy %s']];
         $this->_pattern = new \Magento\ToolkitFramework\ImportExport\Fixture\Complex\Pattern();
         $this->_pattern->setHeaders(array_keys($patternData[0]));
         $this->_pattern->setRowsSet($patternData);
     }
     return $this->_pattern;
 }
 /**
  * Write self data to file
  */
 protected function _loadToFile()
 {
     $fp = fopen($this->_getTemporaryFilePath(), 'w');
     fputcsv($fp, $this->_pattern->getHeaders());
     foreach ($this as $value) {
         fputcsv($fp, $value);
     }
     fclose($fp);
 }
Пример #3
0
 /**
  * Get next row in set
  *
  * @return array|bool
  */
 protected function _getNextRow()
 {
     $key = $this->key();
     $this->_index = $this->getIndex($key);
     if ($key > $this->_limit) {
         return false;
     }
     return $this->_pattern->getRow($this->_index, $key);
 }