You are here

public function MediaService::updateMediaData in Gutenberg 8.2

Same name and namespace in other branches
  1. 8 src/Service/MediaService.php \Drupal\gutenberg\Service\MediaService::updateMediaData()

Update media data.

Parameters

string $fid: File entity ID.

array $data: Media data.

Throws

\Exception

File

src/Service/MediaService.php, line 385

Class

MediaService
The media service class.

Namespace

Drupal\gutenberg\Service

Code

public function updateMediaData(string $fid, array $data) {
  $this->connection
    ->merge('file_managed_data')
    ->key([
    'fid' => $fid,
  ])
    ->fields([
    'data' => serialize($data),
  ])
    ->execute();
}