You are here

public function EntityStatus::getData in CMS Content Sync 2.1.x

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

Get a previously saved key=>value pair.

Parameters

null|string|string[] $key: The key to retrieve

Return value

mixed whatever you previously stored here or NULL if the key doesn't exist

See also

self::setData()

4 calls to EntityStatus::getData()
EntityStatus::getEntityPushHash in src/Entity/EntityStatus.php
EntityStatus::getParentEntity in src/Entity/EntityStatus.php
See above.
EntityStatus::whyDidPullingFail in src/Entity/EntityStatus.php
Get the details provided to ->didPullFail( TRUE, ... ) before.
EntityStatus::whyDidPushingFail in src/Entity/EntityStatus.php
Get the details provided to ->didPushFail( TRUE, ... ) before.

File

src/Entity/EntityStatus.php, line 1032

Class

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

Namespace

Drupal\cms_content_sync\Entity

Code

public function getData($key = null) {
  $data = $this
    ->get('data')
    ->getValue();
  if (empty($data)) {
    return null;
  }
  $storage =& $data[0];
  if (empty($key)) {
    return $data;
  }
  if (!is_array($key)) {
    $key = [
      $key,
    ];
  }
  foreach ($key as $index) {
    if (!isset($storage[$index])) {
      return null;
    }
    $storage =& $storage[$index];
  }
  return $storage;
}