You are here

private function MediaMigrationUuidOracle::getMediaUuidProphecy in Media Migration 8

Returns the UUID prophecy if it exists.

Parameters

int $source_id: The source media entity's identifier.

Return value

string|null The UUID, or NULL if it does not exist at the moment.

1 call to MediaMigrationUuidOracle::getMediaUuidProphecy()
MediaMigrationUuidOracle::getMediaUuid in src/MediaMigrationUuidOracle.php
Returns the UUID of a media entity based on its source ID.

File

src/MediaMigrationUuidOracle.php, line 80

Class

MediaMigrationUuidOracle
Media Migration's UUID oracle.

Namespace

Drupal\media_migration

Code

private function getMediaUuidProphecy(int $source_id) : ?string {
  $results = $this->database
    ->select(MediaMigration::MEDIA_UUID_PROPHECY_TABLE, 'mupt')
    ->fields('mupt')
    ->condition('mupt.' . MediaMigration::MEDIA_UUID_PROPHECY_SOURCEID_COL, $source_id)
    ->execute()
    ->fetchAll();
  return isset($results[0]->{MediaMigration::MEDIA_UUID_PROPHECY_UUID_COL}) ? $results[0]->{MediaMigration::MEDIA_UUID_PROPHECY_UUID_COL} : NULL;
}