/** * Configure job instance for uploaded file * * @param JobInstance $jobInstance * @param File $file * * @return bool */ protected function configureUploadJob(JobInstance $jobInstance, File $file) { $success = false; $job = $jobInstance->getJob(); foreach ($job->getSteps() as $step) { if (method_exists($step, 'getReader')) { $reader = $step->getReader(); if ($reader instanceof UploadedFileAwareInterface) { $constraints = $reader->getUploadedFileConstraints(); $this->fileError = $this->getValidator()->validateValue($file, $constraints); if ($this->fileError->count() !== 0) { foreach ($this->fileError as $error) { $this->addFlash('error', $error->getMessage()); } return false; } else { $reader->setUploadedFile($file); $success = true; } } } } return $success; }
/** * {@inheritDoc} */ public function getJob() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getJob', array()); return parent::getJob(); }