Newscoop\Image\ImageService::remove PHP Метод

remove() публичный Метод

Remove image (files and entity)
public remove ( LocalImage $image ) : boolean
$image LocalImage
Результат boolean
    public function remove(LocalImage $image)
    {
        $filesystem = new Filesystem();
        if (file_exists($image->getPath())) {
            $filesystem->remove($image->getPath());
        }
        if (file_exists($image->getThumbnailPath())) {
            unlink($this->config['thumbnail_path'] . $image->getThumbnailPath(true));
        }
        $articleImages = $this->orm->getRepository('Newscoop\\Image\\ArticleImage')->getArticleImagesForImage($image)->getResult();
        foreach ($articleImages as $articleImage) {
            \ArticleImage::RemoveImageTagsFromArticleText($articleImage->getArticleNumber(), $articleImage->getNumber());
            $this->orm->remove($articleImage);
        }
        $this->orm->remove($image);
        $this->orm->flush();
        $this->cacheService->clearNamespace('article_image');
        $this->cacheService->clearNamespace('image');
        return true;
    }