You are here

public function EntityStatus::getParentEntity in CMS Content Sync 2.0.x

Same name and namespace in other branches
  1. 8 src/Entity/EntityStatus.php \Drupal\cms_content_sync\Entity\EntityStatus::getParentEntity()
  2. 2.1.x src/Entity/EntityStatus.php \Drupal\cms_content_sync\Entity\EntityStatus::getParentEntity()

See above.

Return value

null|\Drupal\Core\Entity\EntityInterface

File

src/Entity/EntityStatus.php, line 848

Class

EntityStatus
Defines the "Content Sync - Entity Status" entity type.

Namespace

Drupal\cms_content_sync\Entity

Code

public function getParentEntity() {
  $parent = $this
    ->getData(self::DATA_PARENT_ENTITY);
  if ($parent) {
    $matches = \Drupal::entityTypeManager()
      ->getStorage($parent['type'])
      ->loadByProperties([
      'uuid' => $parent['uuid'],
    ]);
    if (!count($matches)) {
      return null;
    }
    return reset($matches);
  }
  return null;
}