To debug if your mappings are correct, dump out #expandPath( ‘/orm’ )# and see if points to where you expect. Also note, cborm is the only ColdBox module that usually needs you to manually create a mapping since ORM loads before ColdBox.
Let’s leave aside the mapping for a moment though and look at this line of code:
var service = new cborm.models.VirtualEntityService(entityName=rc.table);
Don’t create CFC’s manually using createObject() or new(). You should be asking WireBox to create/inject/persist this for you! This ensures that all the correct dependencies are injected in and your model is persisted correctly.
Instead of that line, place this cfproperty at the top of your /admin.cfc inside the component tag/keyword:
property name=“userService” inject=“entityService:user”;
If you really need the entity name to be dynamic, you can ask WireBox for entity services ad-hoc:
service = getInstance( dsl=“entityService:#rc.table#” );
This will still provide all the injection and singleton persistence.
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com