You are here

public function EntityTest::getOwnerId in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php \Drupal\entity_test\Entity\EntityTest::getOwnerId()
  2. 9 core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php \Drupal\entity_test\Entity\EntityTest::getOwnerId()

Returns the entity owner's user ID.

Return value

int|null The owner user ID, or NULL in case the user ID field has not been set on the entity.

Overrides EntityOwnerInterface::getOwnerId

File

core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php, line 124

Class

EntityTest
Defines the test entity class.

Namespace

Drupal\entity_test\Entity

Code

public function getOwnerId() {
  return $this
    ->get('user_id')->target_id;
}