Example #1
0
 public function update(File $file)
 {
     $this->setName($file->getName());
     $this->setDescription($file->getDescription());
     $this->setLink($file->getLink());
     $this->setLocalPath($file->getLocalPath());
     $this->setThumbnailLink($file->getThumbnailLink());
     $this->setLocalThumbnailPath($file->getLocalThumbnailPath());
     $this->setCategory($file->getCategory());
     $this->setExtension($file->getExtension());
     $this->setSize($file->getSize());
     $this->setDimensions($file->getDimensions());
     $this->setAuthor($file->getAuthor());
     $this->setCreationDate($file->getCreationDate());
 }
Example #2
0
 public function deleteFileOnDisk(File $file)
 {
     $ret = true;
     if (file_exists($file->getLocalPath())) {
         $ret = @unlink($file->getLocalPath());
     }
     $retThumbnail = true;
     if (file_exists($file->getLocalThumbnailPath())) {
         $retThumbnail = @unlink($file->getLocalThumbnailPath());
     }
     if (!$ret) {
         throw new \Exception(sprintf('Failed to delete file %s with path %s', $file->getName(), $file->getLocalPath()));
     }
     if (!$retThumbnail) {
         throw new \Exception(sprintf('Failed to delete file %s with path %s', $file->getName(), $file->getLocalThumbnailPath()));
     }
 }