You are here

public function Subscriber::getUserId in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Subscriber.php \Drupal\simplenews\Entity\Subscriber::getUserId()
  2. 3.x src/Entity/Subscriber.php \Drupal\simplenews\Entity\Subscriber::getUserId()

Returns corresponding user ID.

Return value

int The corresponding user ID.

Overrides SubscriberInterface::getUserId

1 call to Subscriber::getUserId()
Subscriber::getUser in src/Entity/Subscriber.php
Returns corresponding User object, if any.

File

src/Entity/Subscriber.php, line 102

Class

Subscriber
Defines the simplenews subscriber entity.

Namespace

Drupal\simplenews\Entity

Code

public function getUserId() {
  $value = $this
    ->get('uid')
    ->getValue();
  if (isset($value[0]['target_id'])) {
    return $value[0]['target_id'];
  }
  return '0';
}