Наследование: extends Sulu\Component\Persistence\Model\AuditableInterface
Пример #1
0
 /**
  * @param MediaInterface $media
  *
  * @return FileVersion
  *
  * @throws ImageProxyMediaNotFoundException
  */
 private function getLatestFileVersion(MediaInterface $media)
 {
     foreach ($media->getFiles() as $file) {
         $version = $file->getVersion();
         foreach ($file->getFileVersions() as $fileVersion) {
             if ($fileVersion->getVersion() == $version) {
                 return $fileVersion;
             }
         }
         break;
     }
     throw new ImageProxyMediaNotFoundException('Media file version was not found');
 }
Пример #2
0
 /**
  * Gets the latest file-version of a given media.
  *
  * @param MediaInterface $media
  *
  * @throws FileVersionNotFoundException
  *
  * @return FileVersion
  */
 private function getFileVersionForMedia(MediaInterface $media)
 {
     /** @var File $file */
     $file = $media->getFiles()->get(0);
     if (!isset($file)) {
         throw new FileVersionNotFoundException($media->getId(), 'latest');
     }
     $fileVersion = $file->getLatestFileVersion();
     if (!isset($fileVersion)) {
         throw new FileVersionNotFoundException($media->getId(), 'latest');
     }
     return $fileVersion;
 }