function Node::getCurrentUserId

Default value callback for 'uid' base field definition.

Return value

array 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 Node::getCurrentUserId()
NodeOwnerTest::testGetCurrentUserId in core/modules/node/tests/src/Kernel/NodeOwnerTest.php
Tests the legacy method used as the default entity owner.

File

core/modules/node/src/Entity/Node.php, line 392

Class

Node
Defines the node entity class.

Namespace

Drupal\node\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(),
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.