Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathModuleConfig.cfc
More file actions
Latest commit
98 lines (86 loc) · 3.23 KB
/
Copy pathModuleConfig.cfc
File metadata and controls
98 lines (86 loc) · 3.23 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
component {
this.name="quick";
this.author="Eric Peterson";
this.webUrl="https://github.com/coldbox-modules/quick";
this.dependencies= [ "qb", "str", "mementifier" ];
this.cfmapping="quick";
functionconfigure() {
settings= {
"defaultGrammar":"AutoDiscover@qb",
"defaultQueryOptions": {},
"preventDuplicateJoins":true,
"preventLazyLoading":false,
"lazyLoadingViolationCallback": ( entity, relationName ) => {
throw(
type ="QuickLazyLoadingException",
message ="Attempted to lazy load the [#arguments.relationName#] relationship on the entity [#arguments.entity.mappingName()#] but lazy loading is disabled. This is usually caused by the N+1 problem and is a sign that you are missing an eager load."
);
},
"metadataCache": {
"name":"quickMeta",
"provider":"coldbox.system.cache.providers.CacheBoxColdBoxProvider",
"properties": {
"objectDefaultTimeout":0, // no timeout
"useLastAccessTimeouts":false, // no last access timeout
"maxObjects":300,
"objectStore":"ConcurrentStore"
}
}
};
interceptorSettings= {
customInterceptionPoints: [
"quickInstanceReady",
"quickPreLoad",
"quickPostLoad",
"quickPreSave",
"quickPostSave",
"quickPreInsert",
"quickPostInsert",
"quickPreUpdate",
"quickPostUpdate",
"quickPreDelete",
"quickPostDelete"
]
};
binder.map( "quick.models.BaseEntity" ).to( "#moduleMapping#.models.BaseEntity" );
binder.getInjector().registerDSL( "quickService", "#moduleMapping#.dsl.QuickServiceDSL" );
}
functiononLoad() {
binder
.map( alias ="QuickQB@quick", force =true )
.to( "#moduleMapping#.models.QuickQB" )
.initArg( name ="grammar", dsl =settings.defaultGrammar )
.initArg( name ="preventDuplicateJoins", value =settings.preventDuplicateJoins )
.initArg( name ="defaultOptions", value =settings.defaultQueryOptions )
.initArg( name ="utils", dsl ="QueryUtils@qb" )
.initArg( name ="sqlCommenter", ref ="ColdBoxSQLCommenter@qb" )
.initArg( name ="returnFormat", value ="array" );
if ( isSimpleValue( settings.metadataCache ) ) {
settings.metadataCache= { "name":settings.metadataCache };
}
if ( settings.metadataCache.name!="quickMeta" ) {
binder.map( "cachebox:quickMeta" ).toDSL( "cachebox:#settings.metadataCache.name#" );
} else {
wirebox.getCachebox().createCache( argumentCollection =settings.metadataCache );
}
}
functiononUnload() {
varcacheBox=wirebox.getCachebox();
if ( cacheBox.cacheExists( settings.metadataCache.name ) ) {
cacheBox.getCache( settings.metadataCache.name ).clearAll();
}
}
/**
* This interceptor ensures that the `_mapping` property for a Quick entity
* is correctly set to the mapping used in WireBox.
*
* @event The current request context
* @interceptData The intercept data for `afterInstanceAutowire`.
* { mapping, target, targetID, injector }
*/
functionbeforeInstanceAutowire( event, interceptData ) {
if ( structKeyExists( interceptData.target, "isQuickEntity" ) ) {
interceptData.target.set_mapping( interceptData.targetID );
}
}
}