You are here

ReindexScheduledEvent.php in Search API 8

File

src/Event/ReindexScheduledEvent.php
View source
<?php

namespace Drupal\search_api\Event;

use Drupal\search_api\IndexInterface;
use Symfony\Component\EventDispatcher\Event;

/**
 * Wraps a reindex scheduled event.
 */
final class ReindexScheduledEvent extends Event {

  /**
   * The index scheduled for reindexing.
   *
   * @var \Drupal\search_api\IndexInterface
   */
  protected $index;

  /**
   * Boolean indicating whether the index was also cleared.
   *
   * @var bool
   */
  protected $clear;

  /**
   * Constructs a new class instance.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The index scheduled for reindexing.
   * @param bool $clear
   *   Boolean indicating whether the index was also cleared.
   */
  public function __construct(IndexInterface $index, $clear) {
    $this->index = $index;
    $this->clear = $clear;
  }

  /**
   * Retrieves the index scheduled for reindexing.
   *
   * @return \Drupal\search_api\IndexInterface
   *   The index scheduled for reindexing.
   */
  public function getIndex() {
    return $this->index;
  }

  /**
   * Retrieves a boolean indicating whether the index was also cleared.
   *
   * @return bool
   *   TRUE if the index was also cleared as part of the reindexing, FALSE
   *   otherwise.
   */
  public function isClear() {
    return $this->clear;
  }

}

Classes

Namesort descending Description
ReindexScheduledEvent Wraps a reindex scheduled event.