job = $job; } /** * */ public function run(): bool { if ($this->job->status !== 'configured') { Log::error(sprintf('Job %s is in state %s so it cannot be started.', $this->job->key, $this->job->status)); return false; } Log::debug(sprintf('Start with import job %s', $this->job->key)); $objects = new Collection; $type = $this->job->file_type; $class = config(sprintf('firefly.import_processors.%s', $type)); /** @var FileProcessorInterface $processor */ $processor = app($class); $processor->setJob($this->job); set_time_limit(0); if ($this->job->status == 'configured') { Log::debug('Job is configured, start with run()'); $processor->run(); $objects = $processor->getObjects(); } $storage = new ImportStorage; $storage->setJob($this->job); $storage->setDateFormat($this->job->configuration['date-format']); $storage->setObjects($objects); $storage->store(); // once done, use storage thing to actually store them: Log::debug(sprintf('Returned %d valid objects from file processor', $objects->count())); Log::debug(sprintf('Done with import job %s', $this->job->key)); return true; } }