You are here

public function Subscription::removeScheduledChanges in Commerce Recurring Framework 8

Removes the scheduled changes.

Parameters

string $field_name: (optional) The field name. If provided, only scheduled changes for that field will be removed. Otherwise, all scheduled changes will be removed.

Return value

$this

Overrides SubscriptionInterface::removeScheduledChanges

3 calls to Subscription::removeScheduledChanges()
Subscription::addScheduledChange in src/Entity/Subscription.php
Adds a scheduled change for the given field.
Subscription::applyScheduledChanges in src/Entity/Subscription.php
Apply the scheduled changes.
Subscription::preSave in src/Entity/Subscription.php
Acts on an entity before the presave hook is invoked.

File

src/Entity/Subscription.php, line 633

Class

Subscription
Defines the subscription entity.

Namespace

Drupal\commerce_recurring\Entity

Code

public function removeScheduledChanges($field_name = NULL) {
  foreach ($this
    ->getScheduledChanges() as $scheduled_change) {
    if (!$field_name || $scheduled_change
      ->getFieldName() === $field_name) {
      $this
        ->get('scheduled_changes')
        ->removeScheduledChange($scheduled_change);
    }
  }
  return $this;
}