/**
  * Update the file and file name if necessary.
  *
  * @param EventArgs $args The event arguments.
  */
 public function preUpdate(EventArgs $args)
 {
     $obj = $this->adapter->getObjectFromArgs($args);
     if ($this->isUploadable($obj)) {
         $this->storage->upload($obj);
         $this->adapter->recomputeChangeSet($args);
     }
 }
Пример #2
0
 /**
  * Checks for file to upload.
  */
 public function upload($obj, $mapping)
 {
     $mapping = $this->factory->fromName($obj, $mapping);
     // nothing to upload
     if (!$this->hasUploadedFile($obj, $mapping)) {
         return;
     }
     $this->dispatch(Events::PRE_UPLOAD, new Event($obj, $mapping));
     $this->storage->upload($obj, $mapping);
     $this->injector->injectFile($obj, $mapping);
     $this->dispatch(Events::POST_UPLOAD, new Event($obj, $mapping));
 }