Exemplo n.º 1
0
 public function process()
 {
     if (!$this->validate()) {
         return $this->failure();
     }
     $oldFile = $this->getProperty('path');
     $loaded = $this->getSource();
     if (!$this->source instanceof modMediaSource) {
         return $loaded;
     }
     $success = $this->source->renameObject($oldFile, $this->getProperty('name'));
     if (empty($success)) {
         $msg = '';
         $errors = $this->source->getErrors();
         foreach ($errors as $k => $msg) {
             $this->addFieldError($k, $msg);
         }
         return $this->failure($msg);
     }
     return $this->success();
 }