/** * Process the step * * @param ValidateStepEvent $event * * @return void */ public function process(ValidateStepEvent $event) { $filePath = $event->getModel()->getFilePath(); if (file_exists($filePath) === false) { $event->getModel()->setStatus(''); $event->addViolation('no file found'); } }
/** * Process the step * * @param ValidateStepEvent $event * * @return void */ public function process(ValidateStepEvent $event) { $filePath = $event->getModel()->getFilePath(); $lines = file($filePath); if (empty($lines)) { $event->getModel()->setStatus(''); $event->addViolation('invalid file'); } }
/** * Process the step * * @param ValidateStepEvent $event * * @return void */ public function process(ValidateStepEvent $event) { $filePath = $event->getModel()->getFilePath(); $destination = $filePath . '.save'; var_dump('archive: ' . $filePath . '...'); $r = copy($filePath, $destination); if ($r === false) { $event->getModel()->setStatus(''); $event->addViolation('Copy file impossible'); } }
public function invalid(ValidateStepEvent $event) { $event->addViolation('Validation error!'); }