Skip to content

Commit

Permalink
fix(BaseEntity): Correctly use the grammar annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
elpete committed Feb 19, 2020
1 parent 044a81a commit 2312e9e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions models/BaseEntity.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ component accessors="true" {
/*====================================
= Dependencies =
====================================*/
property name="_builder" inject="provider:QuickQB@quick" persistent="false";
property name="_builder" inject="QuickQB@quick" persistent="false";
property name="_wirebox" inject="wirebox" persistent="false";
property name="_str" inject="provider:Str@str" persistent="false";
property name="_str" inject="Str@str" persistent="false";
property name="_settings" inject="coldbox:modulesettings:quick" persistent="false";
property name="_interceptorService" inject="provider:coldbox:interceptorService" persistent="false";
property name="_entityCreator" inject="provider:EntityCreator@quick" persistent="false";
property name="_interceptorService" inject="coldbox:interceptorService" persistent="false";
property name="_entityCreator" inject="EntityCreator@quick" persistent="false";

/*===========================================
= Metadata Properties =
Expand Down Expand Up @@ -811,11 +811,9 @@ component accessors="true" {
}

public function newQuery() {
if ( variables._meta.originalMetadata.keyExists( "grammar" ) ) {
variables._builder.setGrammar(
variables._wirebox.getInstance( variables._meta.originalMetadata.grammar & "@qb" )
);
}
variables._builder.setGrammar(
variables._wirebox.getInstance( variables._meta.grammar & "@qb" )
);
variables.query = variables._builder.newQuery()
.setReturnFormat( "array" )
.setColumnFormatter( function( column ) {
Expand Down Expand Up @@ -1095,6 +1093,11 @@ component accessors="true" {
if ( variables._queryOptions.isEmpty() && variables._meta.originalMetadata.keyExists( "datasource" ) ) {
variables._queryOptions = { datasource = variables._meta.originalMetadata.datasource };
}
param variables._meta.originalMetadata.grammar = "AutoDiscover";
param variables._meta.grammar = variables._meta.originalMetadata.grammar;
variables._builder.setGrammar(
variables._wirebox.getInstance( variables._meta.grammar & "@qb" )
);
param variables._meta.originalMetadata.readonly = false;
param variables._meta.readonly = variables._meta.originalMetadata.readonly;
variables._readonly = variables._meta.readonly;
Expand Down

0 comments on commit 2312e9e

Please sign in to comment.