Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Crappy Mappings, ie, Crappings

$
0
0

So correct me if I'm wrong.  I have a file structure that looks like this:

 

models

> framework

>> alpha.cfc

application.cfc

 

I am executing from application.cfc.  In it, I have created a mapping (NOTE THE DIFFERENCE IN SINGULAR/PLURAL):

 

<cfset this.mappings[ '/model' ] = expandPath( '/models/framework' ) />

 

When I dump the this.mappings structure, I expectedly get:

 

c:\path\to\webroot\models\framework

 

So I now dump this code:

 

<cfdump var="#fileExists( expandPath( '/model/alpha.cfc' ) )#" />

 

And sure, enough, I get: YES

 

So here's my problem.  I had always thought that in dot notation syntax, ColdFusion looked at the first value provided and did a mapping check on it.  However, when I run:

 

<cfset myNewAlpha = new model.alpha() />

 

I get a message saying the CFC cannot be found.  Only by typing the following:

 

<cfset myNewAlpha = new '/model.alpha'() />

 

Does it actually work and find the CFC through dot notation my using the this-scope mapping.

 

So, is there something I'm missing as to why I can't just call nameOfMapping.path.to.cfc rather than having to make a literal string out of it?


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>