コード例 #1
0
ファイル: PDOReader.php プロジェクト: aboutyou/ayoc-batch
 /**
  * Configures the component with a config array.
  * The component itself should do the necessary steps to read the config.
  *
  * @param array $config
  */
 public function configure(array $config)
 {
     $dsn = ArrayUtils::extractAttribute($config, 'dsn');
     $username = ArrayUtils::extractAttribute($config, 'username');
     $password = ArrayUtils::extractAttribute($config, 'password');
     $query = ArrayUtils::extractAttribute($config, 'query');
     $this->pdo = new \PDO($dsn, $username, $password);
     $this->stmnt = $this->pdo->prepare($query);
 }
コード例 #2
0
ファイル: Config.php プロジェクト: aboutyou/ayoc-batch
 /**
  * Initializes the config.
  * This method will create the steps and their dependencies.
  */
 protected function init()
 {
     $this->name = $this->config['name'];
     foreach ($this->config['steps'] as $stepConfig) {
         $stepClass = ArrayUtils::extractAttribute($stepConfig, '_class');
         /**
          * @var $step StepInterface
          */
         $step = new $stepClass();
         $step->configure($stepConfig);
         $this->steps[] = $step;
     }
 }
コード例 #3
0
ファイル: CSVReader.php プロジェクト: aboutyou/ayoc-batch
 /**
  * Configures the component with a config array.
  * The component itself should do the necessary steps to read the config.
  *
  * @param array $config
  */
 public function configure(array $config)
 {
     $this->filename = \Ayoc\Batch\Util\ArrayUtils::extractAttribute($config, 'filename');
     $this->delimiter = \Ayoc\Batch\Util\ArrayUtils::extractAttribute($config, 'delimiter', ';');
 }
コード例 #4
0
 /**
  * Configures the component with a config array.
  * The component itself should do the necessary steps to read the config.
  *
  * @param array $config
  */
 public function configure(array $config)
 {
     $this->mapping = \Ayoc\Batch\Util\ArrayUtils::extractAttribute($config, 'mapping', []);
     $this->static = \Ayoc\Batch\Util\ArrayUtils::extractAttribute($config, 'static', []);
     $this->dropUnknown = \Ayoc\Batch\Util\ArrayUtils::extractAttribute($config, 'dropUnknown', false);
 }
コード例 #5
0
ファイル: Step.php プロジェクト: aboutyou/ayoc-batch
 /**
  * Configures the component with a config array.
  * The component itself should do the necessary steps to read the config.
  *
  * @param array $config
  */
 public function configure(array $config)
 {
     parent::configure($config);
     $this->batchSize = ArrayUtils::extractAttribute($config, 'batchSize', $this->batchSize);
 }
コード例 #6
0
ファイル: AbstractStep.php プロジェクト: aboutyou/ayoc-batch
 /**
  * Configures the component with a config array.
  * The component itself should do the necessary steps to read the config.
  *
  * @param array $config
  */
 public function configure(array $config)
 {
     $this->name = ArrayUtils::extractAttribute($config, 'name', 'Default Step');
     $readerConfig = ArrayUtils::extractAttribute($config, 'reader');
     $readerClass = ArrayUtils::extractAttribute($readerConfig, '_class');
     /**
      * @var $reader ItemReaderInterface
      */
     $reader = new $readerClass();
     $reader->configure($readerConfig);
     $writerConfig = ArrayUtils::extractAttribute($config, 'writer');
     $writerClass = ArrayUtils::extractAttribute($writerConfig, '_class');
     /**
      * @var $writer ItemWriterInterface
      */
     $writer = new $writerClass();
     $writer->configure($writerConfig);
     $processors = array();
     $processorsConfig = ArrayUtils::extractAttribute($config, 'processors');
     if (is_array($processorsConfig) && $processorsConfig) {
         foreach ($processorsConfig as $pcfg) {
             $pcls = ArrayUtils::extractAttribute($pcfg, '_class');
             /**
              * @var $p ItemProcessorInterface
              */
             $p = new $pcls();
             $p->configure($pcfg);
             $processors[] = $p;
         }
     }
     $this->reader = $reader;
     $this->writer = $writer;
     $this->processors = $processors;
 }