Skip to content

Commit

Permalink
Added method distinct() in Mvc\Model\Criteria
Browse files Browse the repository at this point in the history
  • Loading branch information
KorsaR-ZN committed Jun 23, 2015
1 parent b4ed023 commit 964cd12
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions phalcon/mvc/model/criteria.zep
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ class Criteria implements CriteriaInterface, InjectionAwareInterface
return this;
}

/**
* Sets SELECT DISTINCT / SELECT ALL flag
*/
public function distinct(var distinct) -> <Criteria>
{
let this->_params["distinct"] = distinct;
return this;
}

/**
* Sets the columns to be queried
*
Expand Down
9 changes: 8 additions & 1 deletion phalcon/mvc/model/query/builder.zep
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Builder implements BuilderInterface, InjectionAwareInterface
forUpdate, sharedLock, orderClause, offsetClause, joinsClause,
singleConditionArray, limit, offset, fromClause,
mergedConditions, mergedParams, mergedTypes,
singleCondition, singleParams, singleTypes, with;
singleCondition, singleParams, singleTypes, with, distinct;

if typeof params == "array" {

Expand Down Expand Up @@ -147,6 +147,13 @@ class Builder implements BuilderInterface, InjectionAwareInterface
}
}

/**
* Assign SELECT DISTINCT / SELECT ALL clause
*/
if fetch distinct, params["distinct"] {
let this->_distinct = distinct;
}

/**
* Assign FROM clause
*/
Expand Down

0 comments on commit 964cd12

Please sign in to comment.