You are here

public function Subscription::hasScheduledChange in Commerce Recurring Framework 8

Determines if a scheduled change for the given field exists.

Parameters

string $field_name: The field_name.

mixed $value: (optional) The value.

Return value

bool TRUE if the given change is scheduled, FALSE otherwise.

Overrides SubscriptionInterface::hasScheduledChange

File

src/Entity/Subscription.php, line 645

Class

Subscription
Defines the subscription entity.

Namespace

Drupal\commerce_recurring\Entity

Code

public function hasScheduledChange($field_name, $value = NULL) {
  foreach ($this
    ->getScheduledChanges() as $change) {
    if ($change
      ->getFieldName() != $field_name) {
      continue;
    }
    if (is_null($value) || $change
      ->getValue() == $value) {
      return TRUE;
    }
  }
  return FALSE;
}