/**
  * @param MediaInterface $mixed
  *
  * @return FacadeInterface
  */
 public function transform($mixed)
 {
     $facade = $this->newFacade();
     $facade->id = $mixed->getId();
     $facade->name = $mixed->getName();
     $facade->mimeType = $mixed->getMimeType();
     $mediaFolder = $mixed->getMediaFolder();
     $facade->isDeletable = !$mixed->isUsed() && $this->authorizationChecker->isGranted(TreeFolderPanelStrategy::ROLE_ACCESS_DELETE_MEDIA, $mediaFolder);
     $facade->alt = $this->multiLanguageChoiceManager->choose($mixed->getAlts());
     $facade->title = $this->multiLanguageChoiceManager->choose($mixed->getTitles());
     $facade->original = $this->generateMediaUrl($mixed->getFilesystemName());
     $facade->thumbnail = $this->generateMediaUrl($mixed->getThumbnail());
     if ($this->hasGroup(MediaAdminGroupContext::MEDIA_ALTERNATIVES)) {
         $alternatives = $mixed->getAlternatives();
         foreach ($alternatives as $format => $alternativeName) {
             $facade->addAlternative($format, $this->generateMediaUrl($alternativeName));
             $facade->addLink('_self_format_' . $format, $this->generateRoute('open_orchestra_media_admin_media_override', array('format' => $format, 'mediaId' => $mixed->getId())));
         }
     }
     $facade->isEditable = false;
     if ($this->authorizationChecker->isGranted(TreeFolderPanelStrategy::ROLE_ACCESS_UPDATE_MEDIA, $mediaFolder)) {
         $facade->isEditable = true;
     }
     $facade->addLink('_self_select', $mixed->getId());
     $facade->addLink('_api_full', $this->generateRoute('open_orchestra_api_media_show', array('mediaId' => $mixed->getId())));
     if ($this->hasGroup(MediaAdminGroupContext::MEDIA_ADVANCED_LINKS)) {
         $facade->addLink('_self_select_format', $this->generateRoute('open_orchestra_media_admin_media_select_format', array('mediaId' => $mixed->getId())));
         if ($facade->isEditable) {
             $facade->addLink('_self_crop', $this->generateRoute('open_orchestra_media_admin_media_crop', array('mediaId' => $mixed->getId())));
             $facade->addLink('_self_meta', $this->generateRoute('open_orchestra_media_admin_media_meta', array('mediaId' => $mixed->getId())));
         }
     }
     if ($facade->isDeletable) {
         $facade->addLink('_self_delete', $this->generateRoute('open_orchestra_api_media_delete', array('mediaId' => $mixed->getId())));
     }
     return $facade;
 }
 /**
  * Delete the thumbnail of $media
  *
  * @param MediaInterface $media
  */
 public function deleteAlternatives(MediaInterface $media)
 {
     foreach ($media->getAlternatives() as $storageKey) {
         $this->deleteFile($storageKey);
     }
     parent::deleteAlternatives($media);
 }