ormsettings.cfclocation is recursing subdirectories and should not

Description

Load an application with a model directory as follows:

/model/ORM
/model/ORM/foo

Place Bean.cfc in /model/ORM/foo

Now set ormsettings.cfclocation to ["/model/ORM","/model/ORM/foo"]

Per Adobe and Lucee docs:

Result:

Entity Name [Bean] is ambigous, [C:\inetpub\wwwroot\test\model\ORM\foo\Bean.cfc] and [C:\inetpub\wwwroot\test\model\ORM\foo\Bean.cfc] use the same entity name.

If you remove the the second directory from cfclocation, it works correctly and can load Bean.cfc – because it picks it up by going through subdirectories of /model/ORM, which it should not be doing. Along the same lines, removing the second entry will break ACF since it does not pull in CFCs from subdirectories.

Environment

Lucee 5.2.6.59-RC / JRE 1.8.0u144 on Win10

Activity

Show:
Brad Wood
March 1, 2018, 7:16 PM

I'm pretty sure it's always recursive and the difference is whether it scans just the folder you give it or the entire web root. It would almost have to be recursive in my opinion. People who use lots of nested folders as "packages" for their CFCs might have dozens of folders for all their services and DAOs. I've always pointed ORM at my "models" folder or "models/beans" and let it go from there.

Samuel W. Knowlton
March 1, 2018, 8:55 PM

I went back to ACF11 and tried it with just the one and it does seem to have picked up the bean in the subfolder, but I know we added it for a reason because something wasn't picking it up without our having done so. I'll have to dig to find what that was but I guess that reduces the impact of this ticket from 'breaks compatibility' to 'breaks how it handles an unnecessary edge case'

Pothys - MitrahSoft
March 3, 2018, 6:32 AM
Edited

I've tested this ticket & In ACF working fine while we use [ "/model/ORM/foo/" ] in cfclocation & It seems ACF does not consider their previous directory(like "/model/ORM/").

I'm having CFCs in both following directories,
"/model/ORM/userTable.cfc"
"/model/ORM/foo/userTable.cfc"

1) While using cfclocation = [ "/model/ORM/foo/" ]
ACF Result:

Lucee Result:

2) While using cfclocation = [ "/model/ORM","/model/ORM/foo" ]
// Both results were working as expected
ACF Result :

Lucee Result :

It seems lucee search for the previous directory also but ACF search only inside the directory given in cfclocation.

Michael Offner
March 21, 2018, 7:05 AM

any change on this must make sure not breaking backward compatibility, implementing this in Lucee was dificult becausse the ACF behaviour was not really clear and very bad documented. So it is not suprising we see a difference on this.
for a change we may should consider to get the new behaviour.

Brad Wood
September 17, 2019, 6:36 PM

Even if you do not change the behavior, can't we at least fix the bug reported by Pothy's above? That's just a silly bug that should be easy to detect the same file.

Assignee

Michael Offner

Reporter

Samuel W. Knowlton

Priority

Minor

Labels

Fix versions

None
Configure