Navigation Menu

Skip to content

Commit

Permalink
Add doc block for QueryExpression::addCase
Browse files Browse the repository at this point in the history
  • Loading branch information
Walther Lalk committed Aug 11, 2014
1 parent 3b138e9 commit c053eb4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Database/Expression/QueryExpression.php
Expand Up @@ -266,8 +266,18 @@ public function in($field, $values, $type = null) {
return $this->add(new Comparison($field, $values, $type, 'IN'));
}

public function addCase(QueryExpression $expression, $isTrue = 1, $isFalse = 0) {
return $this->add(new CaseExpression($expression, $isTrue, $isFalse));
/**
* Adds a new case expression to the expression object
*
* @param array|ExpressionInterface $conditions The conditions to test.
* Must be a QueryExpression, or an array of QueryExpressions.
* @param string|array|ExpressionInterface $trueValues Value of each condition if that condition is true
* @param string|array|ExpressionInterface $defaultValue Default value if none of the conditiosn are true
*
* @return QueryExpression
*/
public function addCase($conditions, $trueValues = [], $defaultValue = '0') {
return $this->add(new CaseExpression($conditions, $trueValues, $defaultValue));
}

/**
Expand Down

0 comments on commit c053eb4

Please sign in to comment.