diff --git a/core/lib/Drupal/Core/Database/Query/Select.php b/core/lib/Drupal/Core/Database/Query/Select.php index d369b6415d174a6768c30c3ef574096a7d7295ff..85b859bfe9c08a66f43eec8b5f821286b5b36868 100644 --- a/core/lib/Drupal/Core/Database/Query/Select.php +++ b/core/lib/Drupal/Core/Database/Query/Select.php @@ -333,40 +333,21 @@ public function havingCondition($field, $value = NULL, $operator = NULL) { } /** - * Gets a list of all conditions in the HAVING clause. - * - * This method returns by reference. That allows alter hooks to access the - * data structure directly and manipulate it before it gets compiled. - * - * @return array - * An array of conditions. - * - * @see \Drupal\Core\Database\Query\ConditionInterface::conditions() + * {@inheritdoc} */ public function &havingConditions() { return $this->having->conditions(); } /** - * Gets a list of all values to insert into the HAVING clause. - * - * @return array - * An associative array of placeholders and values. + * {@inheritdoc} */ public function havingArguments() { return $this->having->arguments(); } /** - * Adds an arbitrary HAVING clause to the query. - * - * @param $snippet - * A portion of a HAVING clause as a prepared statement. It must use named - * placeholders, not ? placeholders. - * @param $args - * (optional) An associative array of arguments. - * - * @return $this + * {@inheritdoc} */ public function having($snippet, $args = array()) { $this->having->where($snippet, $args); @@ -374,10 +355,7 @@ public function having($snippet, $args = array()) { } /** - * Compiles the HAVING clause for later retrieval. - * - * @param $connection - * The database connection for which to compile the clause. + * {@inheritdoc} */ public function havingCompile(Connection $connection) { $this->having->compile($connection, $this); @@ -395,12 +373,7 @@ public function extend($extender_name) { } /** - * Sets a condition in the HAVING clause that the specified field be NULL. - * - * @param $field - * The name of the field to check. - * - * @return $this + * {@inheritdoc} */ public function havingIsNull($field) { $this->having->isNull($field); @@ -408,12 +381,7 @@ public function havingIsNull($field) { } /** - * Sets a condition in the HAVING clause that the specified field be NOT NULL. - * - * @param $field - * The name of the field to check. - * - * @return $this + * {@inheritdoc} */ public function havingIsNotNull($field) { $this->having->isNotNull($field); @@ -421,12 +389,7 @@ public function havingIsNotNull($field) { } /** - * Sets a HAVING condition that the specified subquery returns values. - * - * @param \Drupal\Core\Database\Query\SelectInterface $select - * The subquery that must contain results. - * - * @return $this + * {@inheritdoc} */ public function havingExists(SelectInterface $select) { $this->having->exists($select); @@ -434,12 +397,7 @@ public function havingExists(SelectInterface $select) { } /** - * Sets a HAVING condition that the specified subquery returns no values. - * - * @param \Drupal\Core\Database\Query\SelectInterface $select - * The subquery that must contain results. - * - * @return $this + * {@inheritdoc} */ public function havingNotExists(SelectInterface $select) { $this->having->notExists($select); diff --git a/core/lib/Drupal/Core/Database/Query/SelectExtender.php b/core/lib/Drupal/Core/Database/Query/SelectExtender.php index dec70fd185badf35b3a2671a96ae366089f9c481..c4396d2f392ce670bd176c729895a4bc9943a602 100644 --- a/core/lib/Drupal/Core/Database/Query/SelectExtender.php +++ b/core/lib/Drupal/Core/Database/Query/SelectExtender.php @@ -138,6 +138,38 @@ public function havingCompile(Connection $connection) { return $this->query->havingCompile($connection); } + /** + * {@inheritdoc} + */ + public function havingIsNull($field) { + $this->query->havingIsNull($field); + return $this; + } + + /** + * {@inheritdoc} + */ + public function havingIsNotNull($field) { + $this->query->havingIsNotNull($field); + return $this; + } + + /** + * {@inheritdoc} + */ + public function havingExists(SelectInterface $select) { + $this->query->havingExists($select); + return $this; + } + + /** + * {@inheritdoc} + */ + public function havingNotExists(SelectInterface $select) { + $this->query->havingNotExists($select); + return $this; + } + /* Implementations of Drupal\Core\Database\Query\ExtendableInterface. */ public function extend($extender_name) { diff --git a/core/lib/Drupal/Core/Database/Query/SelectInterface.php b/core/lib/Drupal/Core/Database/Query/SelectInterface.php index 0d98285075120809f80b3b960dd6fec60805b8ae..c779fef39a1c33ec969cafe8d7d125dd522b749f 100644 --- a/core/lib/Drupal/Core/Database/Query/SelectInterface.php +++ b/core/lib/Drupal/Core/Database/Query/SelectInterface.php @@ -7,6 +7,8 @@ namespace Drupal\Core\Database\Query; +use Drupal\Core\Database\Connection; + /** * Interface definition for a Select Query object. * @@ -524,6 +526,88 @@ public function execute(); */ public function havingCondition($field, $value = NULL, $operator = NULL); + /** + * Gets a list of all conditions in the HAVING clause. + * + * This method returns by reference. That allows alter hooks to access the + * data structure directly and manipulate it before it gets compiled. + * + * @return array + * An array of conditions. + * + * @see \Drupal\Core\Database\Query\ConditionInterface::conditions() + */ + public function &havingConditions(); + + /** + * Gets a list of all values to insert into the HAVING clause. + * + * @return array + * An associative array of placeholders and values. + */ + public function havingArguments(); + + /** + * Adds an arbitrary HAVING clause to the query. + * + * @param $snippet + * A portion of a HAVING clause as a prepared statement. It must use named + * placeholders, not ? placeholders. + * @param $args + * (optional) An associative array of arguments. + * + * @return $this + */ + public function having($snippet, $args = array()); + + /** + * Compiles the HAVING clause for later retrieval. + * + * @param $connection + * The database connection for which to compile the clause. + */ + public function havingCompile(Connection $connection); + + /** + * Sets a condition in the HAVING clause that the specified field be NULL. + * + * @param $field + * The name of the field to check. + * + * @return $this + */ + public function havingIsNull($field); + + /** + * Sets a condition in the HAVING clause that the specified field be NOT NULL. + * + * @param $field + * The name of the field to check. + * + * @return $this + */ + public function havingIsNotNull($field); + + /** + * Sets a HAVING condition that the specified subquery returns values. + * + * @param \Drupal\Core\Database\Query\SelectInterface $select + * The subquery that must contain results. + * + * @return $this + */ + public function havingExists(SelectInterface $select); + + /** + * Sets a HAVING condition that the specified subquery returns no values. + * + * @param \Drupal\Core\Database\Query\SelectInterface $select + * The subquery that must contain results. + * + * @return $this + */ + public function havingNotExists(SelectInterface $select); + /** * Clone magic method. *