You are here

public function AssetMediaFactory::getFileEntity in Media: Acquia DAM 8

Get an existing file entity for the given asset.

Parameters

int $assetId: The ID of the asset to load the file for.

string $bundle: A specific bundle to fetch the media entity from.

Return value

\Drupal\file\FileInterface|false An existing file entity for the asset or FALSE.

File

src/Service/AssetMediaFactory.php, line 229

Class

AssetMediaFactory
Class AssetMediaFactory.

Namespace

Drupal\media_acquiadam\Service

Code

public function getFileEntity($assetId, $bundle = NULL) {
  $media = $this
    ->getMediaEntity($assetId, $bundle);
  return $media instanceof MediaInterface ? $this
    ->get($media)
    ->getExistingFile() : FALSE;
}