How to correctly delete all images uploaded using sonata-media-bundle
问题 I have uploaded some images using the sonata-media-bundle, as suggested here $media = new Media; $media->setBinaryContent($file->getRealPath()); $media->setContext('myContext'); $media->setProviderName('sonata.media.provider.image'); $mediaManager->save($media); Previous code creates the media correctly all files (according to context config) and db registry. Now what I did to delete the media is calling like this: $media = $mediaManager->findOneBy(array('id' => $id)); $mediaManager->delete(