Exemple #1
0
 /**
  * When deleting an ImageFile also delete the actual file it represents in the file system.
  * The relation on the database will take care of setting references to this image file to null and
  * deleting image_file_text entries.
  *
  * @param bool $deleteFiles
  *
  * @throws \Exception
  * @return bool|null
  */
 public function delete($deleteFiles = true)
 {
     if ($deleteFiles) {
         $this->dispatch(new DeleteFileJob($this->getPath()));
     }
     // FIXME: What if jobs are currently processing/waiting?
     // TODO: Delete thumbnail here?
     // TODO: Delete annotation here?
     return parent::delete();
 }
Exemple #2
0
 /**
  * Upon deleting the Image also delete the ImageFiles.
  *
  * @return bool|null
  * @throws \Exception
  */
 public function delete()
 {
     $this->table = 'images';
     if ($imageFile = $this->getImageFile()) {
         $imageFile->delete();
     }
     if ($thumbnailImageFile = $this->getThumbnailImageFile()) {
         $thumbnailImageFile->delete();
     }
     if ($annotationImageFile = $this->getAnnotationImageFile()) {
         $annotationImageFile->delete();
     }
     if ($uncroppedImageFile = $this->getUncroppedImageFile()) {
         $uncroppedImageFile->delete();
     }
     $result = parent::delete();
     $this->table = 'view_images';
     return $result;
 }