You are here

public function WorkflowTransition::getOwner in Workflow 8

Returns the entity owner's user entity.

Return value

\Drupal\user\UserInterface The owner user entity.

Overrides EntityOwnerInterface::getOwner

3 calls to WorkflowTransition::getOwner()
WorkflowTransition::execute in src/Entity/WorkflowTransition.php
Execute a transition (change state of an entity).
WorkflowTransition::logError in src/Entity/WorkflowTransition.php
Generate a Watchdog error.
WorkflowTransition::post_execute in src/Entity/WorkflowTransition.php
Invokes 'transition post'.

File

src/Entity/WorkflowTransition.php, line 872

Class

WorkflowTransition
Implements an actual, executed, Transition.

Namespace

Drupal\workflow\Entity

Code

public function getOwner() {

  /** @var \Drupal\user\UserInterface $user */
  $user = $this
    ->get('uid')->entity;
  if (!$user || $user
    ->isAnonymous()) {
    $user = User::getAnonymousUser();
    $user
      ->setUsername(\Drupal::config('user.settings')
      ->get('anonymous'));
  }
  return $user;
}