You are here

final class QueryPreExecuteEvent in Search API 8

Same name in this branch
  1. 8 src/Event/QueryPreExecuteEvent.php \Drupal\search_api\Event\QueryPreExecuteEvent
  2. 8 modules/search_api_db/src/Event/QueryPreExecuteEvent.php \Drupal\search_api_db\Event\QueryPreExecuteEvent

Wraps a query pre-execute event.

Hierarchy

  • class \Drupal\search_api_db\Event\QueryPreExecuteEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of QueryPreExecuteEvent

2 files declare their use of QueryPreExecuteEvent
Database.php in modules/search_api_db/src/Plugin/search_api/backend/Database.php
EventListener.php in tests/search_api_test_db/src/EventListener.php

File

modules/search_api_db/src/Event/QueryPreExecuteEvent.php, line 12

Namespace

Drupal\search_api_db\Event
View source
final class QueryPreExecuteEvent extends Event {

  /**
   * The database query to be executed for the search.
   *
   * @var \Drupal\Core\Database\Query\SelectInterface
   */
  protected $dbQuery;

  /**
   * The search query that is being executed.
   *
   * @var \Drupal\search_api\Query\QueryInterface
   */
  protected $query;

  /**
   * Constructs a new class instance.
   *
   * @param \Drupal\Core\Database\Query\SelectInterface $db_query
   *   The database query to be executed for the search.
   * @param \Drupal\search_api\Query\QueryInterface $query
   *   The search query that is being executed.
   */
  public function __construct(SelectInterface $db_query, QueryInterface $query) {
    $this->dbQuery = $db_query;
    $this->query = $query;
  }

  /**
   * Retrieves the database query.
   *
   * Will have "item_id" and "score" columns in its result.
   *
   * @return \Drupal\Core\Database\Query\SelectInterface
   *   The database query.
   */
  public function getDbQuery() {
    return $this->dbQuery;
  }

  /**
   * Sets the database query.
   *
   * @param \Drupal\Core\Database\Query\SelectInterface $dbQuery
   *   The new database query.
   *
   * @return $this
   */
  public function setDbQuery(SelectInterface $dbQuery) {
    $this->dbQuery = $dbQuery;
    return $this;
  }

  /**
   * Retrieves the search query being executed.
   *
   * @return \Drupal\search_api\Query\QueryInterface
   *   The search query being executed.
   */
  public function getQuery() {
    return $this->query;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
QueryPreExecuteEvent::$dbQuery protected property The database query to be executed for the search.
QueryPreExecuteEvent::$query protected property The search query that is being executed.
QueryPreExecuteEvent::getDbQuery public function Retrieves the database query.
QueryPreExecuteEvent::getQuery public function Retrieves the search query being executed.
QueryPreExecuteEvent::setDbQuery public function Sets the database query.
QueryPreExecuteEvent::__construct public function Constructs a new class instance.