You are here

public static function Media::getCurrentUserId in Drupal 8

Default value callback for 'uid' base field definition.

Return value

int[] An array of default values.

Deprecated

The ::getCurrentUserId method is deprecated in 8.6.x and will be removed before 9.0.0.

See also

::baseFieldDefinitions()

1 call to Media::getCurrentUserId()
MediaTest::testGetCurrentUserId in core/modules/media/tests/src/Kernel/MediaTest.php
Tests the legacy method used as the default entity owner.

File

core/modules/media/src/Entity/Media.php, line 521

Class

Media
Defines the media entity class.

Namespace

Drupal\media\Entity

Code

public static function getCurrentUserId() {
  @trigger_error('The ::getCurrentUserId method is deprecated in 8.6.x and will be removed before 9.0.0.', E_USER_DEPRECATED);
  return [
    \Drupal::currentUser()
      ->id(),
  ];
}