Skip to content

Commit

Permalink
Documenting *having functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Feb 4, 2013
1 parent 0bc0d78 commit 8d34e5a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions lib/Cake/Model/Datasource/Database/Query.php
Expand Up @@ -896,6 +896,18 @@ public function group($fields, $overwrite = false) {
return $this;
}

/**
* Adds a condition or set of conditions to be used in the HAVING clause for this
* query. This method operates in exactly the same way as the method ``where()``
* does. Please refer to its documentation for an insight on how to using each
* parameter.
*
* @param string|array|Expression|callback $conditions
* @param array $types associative array of type names used to bind values to query
* @param boolean $overwrite whether to reset conditions with passed list or not
* @see Cake\Model\Datasource\Database\Query::where()
* @return Query
*/
public function having($conditions = null, $types = [], $overwrite = false) {
if ($overwrite) {
$this->_parts['having'] = $this->newExpr();
Expand All @@ -904,11 +916,33 @@ public function having($conditions = null, $types = [], $overwrite = false) {
return $this;
}

/**
* Connects any previously defined set of conditions to the provided list
* using the AND operator in the HAVING clause. This method operates in exactly
* the same way as the method ``andWhere()`` does. Please refer to its
* documentation for an insight on how to using each parameter.
*
* @param string|array|Expression|callback $conditions
* @param array $types associative array of type names used to bind values to query
* @see Cake\Model\Datasource\Database\Query::andWhere()
* @return Query
*/
public function andHaving($conditions, $types = []) {
$this->_conjugate('having', $conditions, 'AND', $types);
return $this;
}

/**
* Connects any previously defined set of conditions to the provided list
* using the OR operator in the HAVING clause. This method operates in exactly
* the same way as the method ``orWhere()`` does. Please refer to its
* documentation for an insight on how to using each parameter.
*
* @param string|array|Expression|callback $conditions
* @param array $types associative array of type names used to bind values to query
* @see Cake\Model\Datasource\Database\Query::orWhere()
* @return Query
*/
public function orHaving($conditions, $types = []) {
$this->_conjugate('having', $conditions, 'OR', $types);
return $this;
Expand Down

0 comments on commit 8d34e5a

Please sign in to comment.