Sulu\Bundle\MediaBundle\Media\FormatManager\FormatManagerInterface::purge PHP Method

purge() public method

Delete the image by the given parameters.
public purge ( integer $idMedia, string $fileName, array $options ) : boolean
$idMedia integer
$fileName string
$options array
return boolean
    public function purge($idMedia, $fileName, $options);

Usage Example

Example #1
0
 /**
  * {@inheritdoc}
  */
 public function delete($id)
 {
     $mediaEntity = $this->mediaRepository->findMediaById($id);
     if (!$mediaEntity) {
         throw new MediaNotFoundException('Media with the ID ' . $id . ' not found.');
     }
     /** @var File $file */
     foreach ($mediaEntity->getFiles() as $file) {
         /** @var FileVersion $fileVersion */
         foreach ($file->getFileVersions() as $fileVersion) {
             $this->formatManager->purge($mediaEntity->getId(), $fileVersion->getName(), $fileVersion->getStorageOptions());
         }
     }
     $this->em->remove($mediaEntity);
     $this->em->flush();
 }
All Usage Examples Of Sulu\Bundle\MediaBundle\Media\FormatManager\FormatManagerInterface::purge