Commit 9c9c981f authored by catch's avatar catch
Browse files

Issue #2711739 by init90, Sonal.Sangale, dpacassi, ashishdalvi, ankithashetty,...

Issue #2711739 by init90, Sonal.Sangale, dpacassi, ashishdalvi, ankithashetty, ayushmishra206, YesCT, rajeshwari10, hussainweb, Vinay15, xjm, Suresh Prabhu Parkala, rakesh.gectcr, snehi, Kamil Serafin, vsujeetkumar, davidhernandez, sushantpaste, Krzysztof Domański, chgasparoto, Abhijith S, jhodgdon, longwave, John Cook, alexpott, joachim, er.pushpinderrana, larowlan, dpi, Alex Liannoy: Missing summary/param/return docs for several QueryInterface methods
parent 439c314f
Loading
Loading
Loading
Loading
+74 −42
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ interface QueryInterface extends AlterableInterface {
   * Gets the ID of the entity type for this query.
   *
   * @return string
   *   The entity type ID.
   */
  public function getEntityTypeId();

@@ -33,8 +34,9 @@ public function getEntityTypeId();
   *     ->execute();
   * @endcode
   *
   * @param $field
   *   Name of the field being queried. It must contain a field name, optionally
   * @param string|\Drupal\Core\Condition\ConditionInterface $field
   *   Name of the field being queried or an instance of ConditionInterface.
   *   In the case of the name, it must contain a field name, optionally
   *   followed by a column name. The column can be the reference property,
   *   usually "entity", for reference fields and that can be followed
   *   similarly by a field name and so on. Additionally, the target entity type
@@ -73,41 +75,50 @@ public function getEntityTypeId();
   *   will only find the "news" tag if it is not the first value. It should be
   *   noted that conditions on specific deltas and delta ranges are only
   *   supported when querying content entities.
   * @param $value
   *   The value for $field. In most cases, this is a scalar and it's treated as
   *   case-insensitive. For more complex operators, it is an array. The meaning
   *   of each element in the array is dependent on $operator.
   * @param $operator
   *   Possible values:
   * @param string|int|bool|array|null $value
   *   (optional) The value for $field. In most cases, this is a scalar and it's
   *   treated as case-insensitive. For more complex operators, it is an array.
   *   The meaning of each element in the array is dependent on $operator.
   *   Defaults to NULL, for most operators (except: 'IS NULL', 'IS NOT NULL')
   *   it always makes the condition false.
   * @param string|null $operator
   *   (optional) The comparison operator. Possible values:
   *   - '=', '<>', '>', '>=', '<', '<=', 'STARTS_WITH', 'CONTAINS',
   *     'ENDS_WITH': These operators expect $value to be a literal of the
   *     same type as the column.
   *   - 'IN', 'NOT IN': These operators expect $value to be an array of
   *     literals of the same type as the column.
   *   - 'BETWEEN': This operator expects $value to be an array of two literals
   *     of the same type as the column.
   * @param $langcode
   *   Language code (optional). If omitted, any translation satisfies the
   *   condition. However, if two or more conditions omit the langcode within
   *   - 'IS NULL', 'IS NOT NULL': These operators ignore $value, for that
   *     reason it is recommended to use a $value of NULL for clarity.
   *   - 'BETWEEN', 'NOT BETWEEN': These operators expect $value to be an array
   *     of two literals of the same type as the column.
   *   If NULL, defaults to the '=' operator.
   * @param string|null $langcode
   *   (optional) The language code allows filtering results by specific
   *   language. If two or more conditions omit the langcode within
   *   one condition group then they are presumed to apply to the same
   *   translation. If within one condition group one condition has a langcode
   *   and another does not they are not presumed to apply to the same
   *   translation.
   *   translation. If omitted (NULL), any translation satisfies the condition.
   *
   * @return $this
   *
   * @see \Drupal\Core\Entity\Query\andConditionGroup
   * @see \Drupal\Core\Entity\Query\orConditionGroup
   * @see \Drupal\Core\Entity\Query\QueryInterface::andConditionGroup()
   * @see \Drupal\Core\Entity\Query\QueryInterface::orConditionGroup()
   * @see \Drupal\Core\Entity\Query\ConditionInterface
   * @see \Drupal\Core\Entity\Query\QueryInterface::exists()
   * @see \Drupal\Core\Entity\Query\QueryInterface::notExists()
   */
  public function condition($field, $value = NULL, $operator = NULL, $langcode = NULL);

  /**
   * Queries for a non-empty value on a field.
   *
   * @param $field
   * @param string $field
   *   Name of a field.
   * @param $langcode
   *   Language code (optional).
   * @param string|null $langcode
   *   (optional) The language code allows filtering results by specific
   *   language. If omitted (NULL), any translation satisfies the condition.
   *
   * @return $this
   */
@@ -116,10 +127,11 @@ public function exists($field, $langcode = NULL);
  /**
   * Queries for an empty field.
   *
   * @param $field
   * @param string $field
   *   Name of a field.
   * @param $langcode
   *   Language code (optional).
   * @param string|null $langcode
   *   (optional) The language code allows filtering results by specific
   *   language. If omitted (NULL), any translation satisfies the condition.
   *
   * @return $this
   */
@@ -128,34 +140,50 @@ public function notExists($field, $langcode = NULL);
  /**
   * Enables a pager for the query.
   *
   * @param $limit
   *   An integer specifying the number of elements per page.  If passed a false
   *   value (FALSE, 0, NULL), the pager is disabled.
   * @param $element
   *   An optional integer to distinguish between multiple pagers on one page.
   *   If not provided, one is automatically calculated.
   * @param int $limit
   *   (optional) An integer specifying the number of elements per page. If
   *   passed 0, the pager is disabled.
   * @param int|null $element
   *   (optional) An integer to distinguish between multiple pagers on one page.
   *   If not provided, one is automatically calculated by incrementing the
   *   next pager element value.
   *
   * @return $this
   *   The called object.
   */
  public function pager($limit = 10, $element = NULL);

  /**
   * @param null $start
   * @param null $length
   * Defines the range of the query.
   *
   * @param int|null $start
   *   (optional) The first record from the result set to return. If NULL,
   *   removes any range directives that are set.
   * @param int|null $length
   *   (optional) The maximum number of rows to return. If $start and $length
   *   are NULL, then a complete result set will be generated. If $start is
   *   not NULL and $length is NULL, then an empty result set will be
   *   generated.
   *
   * @return $this
   *   The called object.
   */
  public function range($start = NULL, $length = NULL);

  /**
   * @param $field
   * Sorts the result set by a given field.
   *
   * @param string $field
   *   Name of a field.
   * @param string $direction
   * @param $langcode
   *   Language code (optional).
   *   (optional) The direction to sort. Allowed values are "ASC" and "DESC".
   *   Defaults to "ASC".
   * @param string|null $langcode
   *   (optional) The language code allows filtering results by specific
   *   language. If omitted (NULL), any translation satisfies the condition.
   *
   * @return $this
   *   The called object.
   *
   * @todo standardize $direction options in
   * https://www.drupal.org/project/drupal/issues/3079258
   */
  public function sort($field, $direction = 'ASC', $langcode = NULL);

@@ -165,27 +193,29 @@ public function sort($field, $direction = 'ASC', $langcode = NULL);
   * For count queries, execute() returns the number entities found.
   *
   * @return $this
   *   The called object.
   */
  public function count();

  /**
   * Enables sortable tables for this query.
   *
   * @param $headers
   * @param array $headers
   *   An array of headers of the same structure as described in
   *   template_preprocess_table(). Use a 'specifier' in place of a 'field' to
   *   specify what to sort on. This can be an entity or a field as described
   *   in condition().
   *
   * @return $this
   *   The called object.
   */
  public function tableSort(&$headers);

  /**
   * Enables or disables access checking for this query.
   *
   * @param bool $access_check
   *   (optional) Whether access check is requested or not. Defaults to TRUE.
   *
   * @return $this
   *   The called object.
   */
  public function accessCheck($access_check = TRUE);

@@ -219,6 +249,7 @@ public function execute();
   * @endcode
   *
   * @return \Drupal\Core\Entity\Query\ConditionInterface
   *   A condition object whose conditions will be combined with AND.
   */
  public function andConditionGroup();

@@ -241,12 +272,13 @@ public function andConditionGroup();
   * Note that this particular example can be simplified:
   * @code
   *   $entity_ids = $query
   *     ->condition('attributes.color', array('red', 'green'))
   *     ->condition('attributes.color', ['red', 'green'])
   *     ->condition('attributes.building_type', 'bikeshed')
   *     ->execute();
   * @endcode
   *
   * @return \Drupal\Core\Entity\Query\ConditionInterface
   *   A condition object whose conditions will be combined with OR.
   */
  public function orConditionGroup();