forked from coldbox-modules/quick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModuleConfig.cfc
51 lines (45 loc) · 1.59 KB
/
ModuleConfig.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
component {
this.name = "quick";
this.author = "Eric Peterson";
this.webUrl = "https://github.com/coldbox-modules/quick";
this.dependencies = [ "qb", "str", "cfcollection" ];
this.cfmapping = "quick";
function configure() {
settings = {
defaultGrammar = "BaseGrammar",
automaticValidation = true
};
interceptorSettings = {
customInterceptionPoints = [
"quickPreLoad",
"quickPostLoad",
"quickPreSave",
"quickPostSave",
"quickPreInsert",
"quickPostInsert",
"quickPreUpdate",
"quickPostUpdate",
"quickPreDelete",
"quickPostDelete"
]
};
interceptors = [
{ class="#moduleMapping#.interceptors.QuickVirtualInheritanceInterceptor" }
];
binder.map( "quick.models.BaseEntity" )
.to( "#moduleMapping#.models.BaseEntity" );
}
function onLoad() {
// remap to force the return format to be QuickCollection
binder.map( alias = "QueryBuilder@qb", force = true )
.to( "qb.models.Query.QueryBuilder" )
.initArg( name = "grammar", dsl = "#settings.defaultGrammar#@qb" )
.initArg( name = "utils", dsl = "QueryUtils@qb" )
.initArg( name = "returnFormat", value = function( q ) {
return wirebox.getInstance(
name = "QuickCollection@quick",
initArguments = { collection = q }
);
} );
}
}