CodeExplorer removeOldMediaData example
$currentMedia =
$this->
findMediaById($mediaId,
$context);
$destination =
$this->
validateFileName($destination);
$this->
ensureFileNameIsUnique( $currentMedia,
$destination,
$mediaFile->
getFileExtension(),
$context );
$this->
validateFileExtension($mediaFile,
$mediaId,
$currentMedia->
isPrivate());
$this->
removeOldMediaData($currentMedia,
$context);
$mediaType =
$this->typeDetector->
detect($mediaFile);
$metaData =
$this->metadataLoader->
loadFromFile($mediaFile,
$mediaType);
$media =
$this->
updateMediaEntity( $mediaFile,
$destination,
$currentMedia,
$metaData,
$mediaType,
$context );