/** * 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); }
/** * 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; } }
/** * 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', ';'); }
/** * 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); }
/** * 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); }
/** * 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; }