class EquivalentUpdate

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Update/EquivalentUpdate.php \Drupal\Core\Update\EquivalentUpdate

Value object to hold information about an equivalent update.

Hierarchy

Expanded class hierarchy of EquivalentUpdate

See also

module.api.php

2 files declare their use of EquivalentUpdate
equivalent_update_test.install in core/modules/system/tests/modules/equivalent_update_test/equivalent_update_test.install
Update hooks and schema definition for the update_test_schema module.
update.inc in core/includes/update.inc
Drupal database update API.

File

core/lib/Drupal/Core/Update/EquivalentUpdate.php, line 12

Namespace

Drupal\Core\Update
View source
final class EquivalentUpdate {
  
  /**
   * Constructs a EquivalentUpdate object.
   *
   * @param string $module
   *   The module the update is for.
   * @param int $future_update
   *   The equivalent future update.
   * @param int $ran_update
   *   The update that already ran and registered the equivalent update.
   * @param string $future_version
   *   The future version that has the expected update.
   */
  public function __construct(public readonly string $module, public readonly int $future_update, public readonly int $ran_update, public readonly string $future_version) {
  }
  
  /**
   * Creates a message to explain why an update has been skipped.
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup
   *   An message explaining why an update has been skipped.
   */
  public function toSkipMessage() : TranslatableMarkup {
    return new TranslatableMarkup('Update @number for the @module module has been skipped because the equivalent change was already made in update @ran_update.', [
      '@number' => $this->future_update,
      '@module' => $this->module,
      '@ran_update' => $this->ran_update,
    ]);
  }

}

Members

Title Sort descending Modifiers Object type Summary
EquivalentUpdate::toSkipMessage public function Creates a message to explain why an update has been skipped.
EquivalentUpdate::__construct public function Constructs a EquivalentUpdate object.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.