Skip to content

Commit

Permalink
refactor(QueryBuilder): Rename callback to query for subSelect
Browse files Browse the repository at this point in the history
Rename callback to query for consistency now that any
method that takes a callback should also take a builder instance.

BREAKING CHANGE: Named argument calls to subSelect will need
to use query instead of subselect.
  • Loading branch information
elpete committed Oct 5, 2019
1 parent 7255fa3 commit 87b27f5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions models/Query/QueryBuilder.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,16 @@ component displayname="QueryBuilder" accessors="true" {
*/
public QueryBuilder function subSelect(
required string alias,
required any callback
required any query
) {
var subselect = callback;
if ( isClosure( callback ) ) {
subselect = newQuery();
callback( subselect );
if ( isClosure( query ) ) {
var callback = arguments.query;
arguments.query = newQuery();
callback( arguments.query );
}
return selectRaw(
"( #subselect.toSQL()# ) AS #getGrammar().wrapAlias( alias )#",
subselect.getBindings()
"( #arguments.query.toSQL()# ) AS #getGrammar().wrapAlias( arguments.alias )#",
arguments.query.getBindings()
);
}

Expand Down

0 comments on commit 87b27f5

Please sign in to comment.