Let me preface this: The following code is in the pseudo-constructor of my application.cfc (outside all functions) and this is the FIRST run of the application (so the application has not yet initialized)
With that being said, I wrote the following code:
<cfset this.mappings[ '/model' ] = expandPath( '/path/to/models/folder' ) />
To make sure it took, I dump it:
<cfdump var="#directoryExists( '/model' )#" />
And sure enough I get: YES.
Remove the dump and add the following code:
<cfset myConfig = new model.utils.Config() />
And CF errors out telling me it cannot find a Config.cfc. Well, I verified. In that 'models' folder, there is a 'utils' folder and a 'Config.cfc' in there. If I instead change the line to read:
<cfset myConfig = new path.to.models.folder.utils.Config() />
Then it works fine. So in essence, the mapping is not working. I have an odd feeling that this is all due to the fact that I'm doing this in the pseudo constructor area, but if that's the natural place where you define this-scoped variables, I would think this is OK. I know the application.cfc is LIKE a CFC, but in some ways different.
Well, if I create a this-scoped variable in some other CFC file, I can immediately reference the variable and value on the life after, even in that CFC's pseudo or in the INIT before I perform a <cfreturn this />
I'm trying to understand why the mapping is not working. A problem I have is that the returntype attribute of my Config.cfc is 'model.utils.Config', and this errors out when I use the 'new path.to.models.folder.utils.Config()' method, understandably because they're different FQDNs.