You are here

public function ProtectionRule::getProtectedEntity in User protect 8

Gets the protected entity.

Return value

EntityInterface The loaded entity, if found. NULL otherwise.

Overrides ProtectionRuleInterface::getProtectedEntity

1 call to ProtectionRule::getProtectedEntity()
ProtectionRule::calculateDependencies in src/Entity/ProtectionRule.php
Overrides ConfigEntityBase::calculateDependencies().

File

src/Entity/ProtectionRule.php, line 147

Class

ProtectionRule
Defines the Protection rule entity.

Namespace

Drupal\userprotect\Entity

Code

public function getProtectedEntity() {
  if ($this
    ->getProtectedEntityId()) {
    return \Drupal::entityTypeManager()
      ->getStorage($this
      ->getProtectedEntityTypeId())
      ->load($this
      ->getProtectedEntityId());
  }
}