diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/query/QueryInterface.php b/core/modules/views/lib/Drupal/views/Plugin/views/query/QueryInterface.php index 0b00a17..2d474f1 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/query/QueryInterface.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/QueryInterface.php @@ -2,16 +2,173 @@ /** * @file - * Definition of Drupal\views\Plugin\query\QueryInterface. + * Contains \Drupal\views\Plugin\query\QueryInterface. */ namespace Drupal\views\Plugin\views\query; use Drupal\views\Plugin\views\PluginInterface; +use Drupal\views\ViewExecutable; /** * @todo. */ interface QueryInterface extends PluginInterface { + /** + * Generate a query and a countquery from all of the information supplied + * to the object. + * + * @param $get_count + * Provide a countquery if this is true, otherwise provide a normal query. + */ + public function query($get_count = FALSE); + + /** + * Let modules modify the query just prior to finalizing it. + * + * @param view $view + * The view which is executed. + */ + function alter(ViewExecutable $view); + + /** + * Builds the necessary info to execute the query. + * + * @param view $view + * The view which is executed. + */ + function build(ViewExecutable $view); + + /** + * Executes the query and fills the associated view object with according + * values. + * + * Values to set: $view->result, $view->total_rows, $view->execute_time, + * $view->pager['current_page']. + * + * $view->result should contain an array of objects. The array must use a + * numeric index starting at 0. + * + * @param view $view + * The view which is executed. + */ + function execute(ViewExecutable $view); + + /** + * Add a signature to the query, if such a thing is feasible. + * + * This signature is something that can be used when perusing query logs to + * discern where particular queries might be coming from. + * + * @param view $view + * The view which is executed. + */ + public function addSignature(ViewExecutable $view); + + /** + * Get aggregation info for group by queries. + * + * If NULL, aggregation is not allowed. + */ + public function getAggregationInfo(); + + /** + * @todo + */ + public function validateOptionsForm(&$form, &$form_state); + + /** + * @todo + */ + public function submitOptionsForm(&$form, &$form_state); + + /** + * @todo + */ + public function summaryTitle(); + + /** + * Set a LIMIT on the query, specifying a maximum number of results. + */ + public function setLimit($limit); + + /** + * Set an OFFSET on the query, specifying a number of results to skip + */ + public function setOffset($offset); + + /** + * Returns the limit of the query. + */ + public function getLimit(); + + /** + * Create a new grouping for the WHERE or HAVING clause. + * + * @param $type + * Either 'AND' or 'OR'. All items within this group will be added + * to the WHERE clause with this logical operator. + * @param $group + * An ID to use for this group. If unspecified, an ID will be generated. + * @param $where + * 'where' or 'having'. + * + * @return $group + * The group ID generated. + */ + public function setWhereGroup($type = 'AND', $group = NULL, $where = 'where'); + + /** + * Control how all WHERE and HAVING groups are put together. + * + * @param $type + * Either 'AND' or 'OR' + */ + public function setGroupOperator($type = 'AND'); + + /** + * Loads all entities contained in the passed-in $results. + *. + * If the entity belongs to the base table, then it gets stored in + * $result->_entity. Otherwise, it gets stored in + * $result->_relationship_entities[$relationship_id]; + * + * Query plugins that don't support entities can leave the method empty. + */ + function loadEntities(&$results); + + /** + * Returns a Unix timestamp to database native timestamp expression. + * + * @param string $field + * The query field that will be used in the expression. + * + * @return string + * An expression representing a timestamp with time zone. + */ + public function getDateField($field); + + /** + * Set the database to the current user timezone, + * + * @return string + * The current timezone as returned by drupal_get_user_timezone(). + */ + public function setupTimezone(); + + /** + * Creates cross-database date formatting. + * + * @param string $field + * An appropriate query expression pointing to the date field. + * @param string $format + * A format string for the result, like 'Y-m-d H:i:s'. + * + * @return string + * A string representing the field formatted as a date in the format + * specified by $format. + */ + public function getDateFormat($field, $format); + } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php index 60ed13f..6ca3606 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/QueryPluginBase.php @@ -31,105 +31,75 @@ protected $limit; /** - * Generate a query and a countquery from all of the information supplied - * to the object. - * - * @param $get_count - * Provide a countquery if this is true, otherwise provide a normal query. + * {@inheritdoc} */ public function query($get_count = FALSE) { } /** - * Let modules modify the query just prior to finalizing it. - * - * @param view $view - * The view which is executed. + * {@inheritdoc} */ function alter(ViewExecutable $view) { } /** - * Builds the necessary info to execute the query. - * - * @param view $view - * The view which is executed. + * {@inheritdoc} */ function build(ViewExecutable $view) { } /** - * Executes the query and fills the associated view object with according - * values. - * - * Values to set: $view->result, $view->total_rows, $view->execute_time, - * $view->pager['current_page']. - * - * $view->result should contain an array of objects. The array must use a - * numeric index starting at 0. - * - * @param view $view - * The view which is executed. + * {@inheritdoc} */ function execute(ViewExecutable $view) { } /** - * Add a signature to the query, if such a thing is feasible. - * - * This signature is something that can be used when perusing query logs to - * discern where particular queries might be coming from. - * - * @param view $view - * The view which is executed. + * {@inheritdoc} */ public function addSignature(ViewExecutable $view) { } /** - * Get aggregation info for group by queries. - * - * If NULL, aggregation is not allowed. + * {@inheritdoc} */ public function getAggregationInfo() { } + /** + * {@inheritdoc} + */ public function validateOptionsForm(&$form, &$form_state) { } + /** + * {@inheritdoc} + */ public function submitOptionsForm(&$form, &$form_state) { } + /** + * {@inheritdoc} + */ public function summaryTitle() { return t('Settings'); } /** - * Set a LIMIT on the query, specifying a maximum number of results. + * {@inheritdoc} */ public function setLimit($limit) { $this->limit = $limit; } /** - * Set an OFFSET on the query, specifying a number of results to skip + * {@inheritdoc} */ public function setOffset($offset) { $this->offset = $offset; } /** - * Returns the limit of the query. + * {@inheritdoc} */ public function getLimit() { return $this->limit; } /** - * Create a new grouping for the WHERE or HAVING clause. - * - * @param $type - * Either 'AND' or 'OR'. All items within this group will be added - * to the WHERE clause with this logical operator. - * @param $group - * An ID to use for this group. If unspecified, an ID will be generated. - * @param $where - * 'where' or 'having'. - * - * @return $group - * The group ID generated. + * {@inheritdoc} */ public function setWhereGroup($type = 'AND', $group = NULL, $where = 'where') { // Set an alias. @@ -149,60 +119,33 @@ public function setWhereGroup($type = 'AND', $group = NULL, $where = 'where') { } /** - * Control how all WHERE and HAVING groups are put together. - * - * @param $type - * Either 'AND' or 'OR' + * {@inheritdoc} */ public function setGroupOperator($type = 'AND') { $this->group_operator = strtoupper($type); } /** - * Loads all entities contained in the passed-in $results. - *. - * If the entity belongs to the base table, then it gets stored in - * $result->_entity. Otherwise, it gets stored in - * $result->_relationship_entities[$relationship_id]; - * - * Query plugins that don't support entities can leave the method empty. + * {@inheritdoc} */ function loadEntities(&$results) {} /** - * Returns a Unix timestamp to database native timestamp expression. - * - * @param string $field - * The query field that will be used in the expression. - * - * @return string - * An expression representing a timestamp with time zone. + * {@inheritdoc} */ public function getDateField($field) { return $field; } /** - * Set the database to the current user timezone, - * - * @return string - * The current timezone as returned by drupal_get_user_timezone(). + * {@inheritdoc} */ public function setupTimezone() { return drupal_get_user_timezone(); } /** - * Creates cross-database date formatting. - * - * @param string $field - * An appropriate query expression pointing to the date field. - * @param string $format - * A format string for the result, like 'Y-m-d H:i:s'. - * - * @return string - * A string representing the field formatted as a date in the format - * specified by $format. + * {@inheritdoc} */ public function getDateFormat($field, $format) { return $field; diff --git a/core/modules/views/lib/Drupal/views/ViewExecutable.php b/core/modules/views/lib/Drupal/views/ViewExecutable.php index 0ce6a2c..b49651d 100644 --- a/core/modules/views/lib/Drupal/views/ViewExecutable.php +++ b/core/modules/views/lib/Drupal/views/ViewExecutable.php @@ -178,7 +178,7 @@ class ViewExecutable { /** * Where the $query object will reside. * - * @var Drupal\views\Plugin\query\QueryInterface + * @var \Drupal\views\Plugin\query\QueryInterface */ public $query = NULL; @@ -192,14 +192,14 @@ class ViewExecutable { /** * The current used display plugin. * - * @var Drupal\views\Plugin\views\display\DisplayPluginBase + * @var \Drupal\views\Plugin\views\display\DisplayPluginBase */ public $display_handler; /** * The list of used displays of the view. * - * An array containing Drupal\views\Plugin\views\display\DisplayPluginBase + * An array containing \Drupal\views\Plugin\views\display\DisplayPluginBase * objects. * * @var \Drupal\views\DisplayBag