[coldbox-5.2.0+791] coldbox create orm-crud error

In CommandBox, I’m in my application’s directory, \myapp and I run:

coldbox create orm-crud models.User

This gives me:

invalid component definition, can’t find component [cborm.models.ActiveEntity]

I have:


…present and I added:

this.mappings[ “/cborm” ] = COLDBOX_APP_ROOT_PATH & “modules/cborm”;

…to my application.cfc. It seems clear to me that CommandBox is not seeing that.

What do I need to do to in order to tell CommandBox where cborm is located?

That command doesn’t work on CFCs that extend the active entity-- or extend really ANY CFC which isn’t going to be defined in the CLI context The problem is, the command uses getComponentMetadata() in the CLI which compiles the component and it errors if the extends points to a class that doesn’t exist in the Lucee context powering the CLI.

I did some work on being able to install cborm directly in the CLI so things like cborm.models.activeEntity would be defined there but I forget if I got it working or got distracted before I finished. This is just a common problem when trying to interact with CFCs from your web app inside the CLI which isn’t the same application as your web app. Just beause the cborm files are “nearby” on the disk doesn’t mean Lucee in the CLI knows about them.

Got it, thanks! Perhaps that should be the new error message from CommandBox: “This command doesn’t work on CFCs that extend the active entity-- or extend really ANY CFC which isn’t going to be defined in the CLI context.”


So, I re-ran coldbox create orm-entity with activeEntity=false and then tried coldbox create orm-crud again and received the same error. My models\User.cfc doesn’t mention ActiveEntity. What am I doing wrong?

Hi John,

I had this problem a while ago.

Try run this command in commandbox

repl “$shell.getFileSystem().createMapping( ‘/cborm’, ‘C:/full/path/to/cbormfolder’ )”

That seems to have worked. Thanks!

No problem!,

the credit does goto Brad Wood though, he did give the me snippet a couple months ago.


Yes sorry- as I stated originally a CFC with ANY extends that points to a base class which is not accessible by the CLI will give you these issues. I’m not a huge fan of the coldbox create orm-entity commands for this reason, but they weren’t added to CommandBox by me. You’ll need to take that up with Luis :slight_smile:

This is one of the shortcomings of CFML in my opinion-- reliance on the mappings that are part of your application’s file structure in relation to the web root and CF mappings defined ad-hoc in Application.cfc. That may be ok for a web app, but it doesn’t translate into something more portable. The Java equiv would be classpath and in Java you can provide any custom classpath to a Java program that you want so all classes are resolvable. CFML has no such concept and when you try to re-use modules outside of their web home, you run into these issues.

We could probably mitigate this if we wanted by bundling the cborm module in the CLI or spoofing the cborm.* classes in the CLI but that wouldn’t necessarily fix every scenario. Any CFC that extended 'random.path.that.does.not.exist.in.the.CLI` would give you the same error based on how getComponentMetadat() works.