Skip to content

Commit

Permalink
Fix WireBox mapping for newly required returnFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
elpete committed Mar 10, 2017
1 parent 0493b4a commit 61d8a14
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions ModuleConfig.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ component {
function configure() {
settings = {
defaultGrammar = "BaseGrammar",
returningArrays = true,
returnFormat = ""
returnFormat = "array"
};

binder.map( "BaseGrammar@qb" )
Expand Down Expand Up @@ -40,7 +39,8 @@ component {
binder.map( "builder@qb" )
.to( "qb.models.Query.Builder" )
.initArg( name = "grammar", ref = "#settings.defaultGrammar#@qb" )
.initArg( name = "utils", ref = "QueryUtils@qb" );
.initArg( name = "utils", ref = "QueryUtils@qb" )
.initArg( name = "returnFormat", value = settings.returnFormat );
}

}
13 changes: 8 additions & 5 deletions models/Query/Builder.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ component displayname="Builder" accessors="true" {
property name="utils";

/**
* Injected returnFormat callback, if any.
* returnFormat callback
* If provided, the result of the callback is returned as the result of builder.
* @default ""
* Can optionally pass either "array" or "query"
* and the correct callback will be generated
* @default "array"
*/
property name="returnFormat" inject="coldbox:setting:returnFormat@qb";
property name="returnFormat";

/******************** Query Properties ********************/

Expand Down Expand Up @@ -132,12 +134,13 @@ component displayname="Builder" accessors="true" {
*/
public Builder function init(
Grammar grammar = new qb.models.Query.Grammars.Grammar(),
QueryUtils utils = new qb.models.Query.QueryUtils()
QueryUtils utils = new qb.models.Query.QueryUtils(),
any returnFormat = "array"
) {
variables.grammar = arguments.grammar;
variables.utils = arguments.utils;

setReturnFormat( "array" );
setReturnFormat( arguments.returnFormat );

setDefaultValues();

Expand Down

0 comments on commit 61d8a14

Please sign in to comment.