[coldbox-3.7.0] BaseORM get weirdness since upgrade

Hi, I am upgrading from 3.1.0 to 3.7.0 and am running into an error/weirdness with the BaseORM get method

I have a news module that loads a news article based on the passed articleID. My code that has worked before in 3.1 is:

<cfset rc.oArticle = newsService.get(“newsArticle”,rc.ArticleID) />

But now with 3.7, I get this error when I run this:

The value newsArticle cannot be converted to a number.


\coldbox_3.7.0\system\orm\hibernate\BaseORMService.cfc (480)
\coldbox_3.7.0\system\orm\hibernate\VirtualEntityService.cfc (124)
\modules\news\handlers\admin.cfc (113)

But if I alter my code to be more explicit:

<cfset rc.oArticle = newsService.get(entity=“newsArticle”,id=rc.ArticleID) />

It works just fine. Is there a change I can make somewhere to let the less-explicit syntax work, or do I need to modify all of my ORM calls? Or is there a setting somewhere that I’m missing?

Any advice is appreciated. Thanks!

Have you changed the way that you are creating the service? Perhaps you can show that code. From the stack trace, you are using the virtual entity service, but that service doesn’t require you to pass in the entity name on every call. Your code should look like this:

newsService = new VirtualEntityService(entityName=“newsArticle”);
rc.oArticle = newsService.get(rc.ArticleID)

Since you are passing positional arguments, the entity name is gettin used as the primary key. Now that being said, I don’t know why the behavior would have changed from ColdBox 3.1 to 3.7.

Are you on Railo or Adobe CF? Can you show the code where you create the service/

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

No, I haven’t changed anything else about how it’s being created. From within the component I’m injecting the service as a property:

and then calling it within the event handler with:
<cfset rc.oArticle = newsService.get(“newsArticle”,rc.ArticleID) />

The current server is CF9 and ColdBox 3.1, I’m trying to migrate over to a new server with CF 10 and Coldbox 3.7.

I was working off of http://wiki.coldbox.org/wiki/Extras:BaseORMService.cfm#get but that’s using the BaseORM, so since I’m using the VirtualEntityService, and already passing it an entity upon injection, I don’t/shouldn’t keep re-passing it the entity, right? Would I have to do that if I was using the BaseORM directly? Maybe I’ve been using the wrong syntax all along and it just caught up with me…

I think you’ve been wrong all along, but honestly I’m not sure how it worked before. Perhaps a subtle difference in how CF9 and CF10 handle positional arguments and argumentCollection. I don’t have CF9 installed right now to play with it. But yes, I think the ultimate answer is to simply take the entity name out of all your calls as long as you’re using the entity name when creating the service.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Yeah, I understand what I was doing wrong now. Thanks for talking this through with me Brad!