You are here

public function EntityStatus::didPullFail 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::didPullFail()
  2. 2.1.x src/Entity/EntityStatus.php \Drupal\cms_content_sync\Entity\EntityStatus::didPullFail()

Returns the information if the last pull of the entity failed.

Parameters

bool $set: Optional parameter to set the value for PullFailed

bool $soft: A soft fail- this was intended according to configuration. But the user might want to know why to debug different expectations.

null|array $details: If $set is TRUE, you can provide additional details on why the pull failed. Can be gotten via ->whyDidPullFail()

Return value

bool

1 call to EntityStatus::didPullFail()
EntityStatus::setLastPull in src/Entity/EntityStatus.php
Set the last pull timestamp.

File

src/Entity/EntityStatus.php, line 568

Class

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

Namespace

Drupal\cms_content_sync\Entity

Code

public function didPullFail($set = null, $soft = false, $details = null) {
  $flag = $soft ? self::FLAG_PULL_FAILED_SOFT : self::FLAG_PULL_FAILED;
  if (true === $set) {
    $this
      ->set('flags', $this
      ->get('flags')->value | $flag);
    if (!empty($details)) {
      $this
        ->setData(self::DATA_PULL_FAILURE, $details);
    }
  }
  elseif (false === $set) {
    $this
      ->set('flags', $this
      ->get('flags')->value & ~$flag);
    $this
      ->setData(self::DATA_PULL_FAILURE, null);
  }
  return (bool) ($this
    ->get('flags')->value & $flag);
}