I'm getting the following error when I have a property defined in a
component with the same name as another model (full stack trace
below).
Application Execution Exception
Error Type: Application : [N/A]
Error Messages: Entity has incorrect type for being called as a
function.
The symbol you provided setTEST2 is not the name of a function.
I traced the issue through ColdBox it's picking up on the generated
getTest2 accessor as a setterInjector and is throwing the error when
calling the method with CFINVOKE. (MethodInjector.invokerMixin())
Some observations:
+ If I define an explicit setter for the setTest2 property there is no
error.
+ In MethodInjector.cfc If I use evaluate instead of cfinvoke I don't
get an error
<cfset refLocal.results = evaluate
( "#arguments.method#( argumentCollection =
arguments.argCollection )" ) />
Any thoughts on this one? Latest SVN ColdBox, CF 9.0.1
Did you setup an eventHandler in your ORM settings?
<cfset this.ormsettings = {
eventhandling=true,
eventhandler="model.ORMEventHandler"}
model.ORMEventHandler Example
/**
* @hint The ORM event handler. If using the entity injector and you
override a postLoad() handler, then you must
* call the super.postLoad(arguments.entity) manually.
* @output false
* @injector true
* @injectorInclude ''
* @injectorExclude ''
*/
component extends="coldbox.system.orm.hibernate.EventHandler"{
public void function postLoad(any Entity){
// call super method to activate injector
super.postLoad(entity);
// Use logbox to log some debug messages
getLogger(this).debug("post load an entity: #getMetaData(entity).name#");
}
public void function postUpdate(any Entity){
// Use logbox to log some debug messages
getLogger(this).debug("post update an entity: #getMetaData(entity).name#");
// Use the coldbox interceptors to announce AOP style
updates, so all AOP listners do audit
// enableSetterInjection
if(NOT propertyExists(“enableSetterInjection”) OR
NOT isBoolean(getProperty(‘enableSetterInjection’)) ){
setProperty(“enableSetterInjection”,‘false’);
}
Ok, so basically the problem is that the setter injection detects it and tries to set something on it but cfinvoke fails on cf9 orm auto-generated setters? That sounds like a bug to me on CF also.
Yeah that is basically what is happening. I didn't test cfinvoke on a
generated setter outside of ColdBox to see if it was a CF specific
issue so I am not sure if it is ColdBox or ColdFusion
Hmm, seems cfinvoke does work, are you sure it is not something else?
Maybe the setter is being called for something that does not exist?
Luis F. Majano
President
Ortus Solutions, Corp
I'm pretty sure. I tore all the code out of my models to isolate it
(code in the first post). I could bundle up the app and send it to
you if that would be an easier way to reproduce.
Also, the new setter injection in wirebox will need the annotation as well. I prefer this approach if not ALL setter are inspected and is not congruent and a waste of time in my opinion. So it will follow the same pattern of property injection, in which only setters with the @inject annotation will be autowired.
THis will have to be the explicit case of ORM entities as they cannot be constructed from scratch as CF provides the entities for us, we can only intercept them. Does this make sense?
However, right now it allows for setters without the annotation also. So the idea is to make them strict and only autowire annotated setters. That is the ticket.
I'm following ya Louis. Do you have any insight into what the error
was from?
Aaron - Yeah the work around was to not have a generated setter or
create an explicit setter in the component. I'm looking forward to
seeing the ticket closed sooner than latter though because I'm bad at
remembering to go back and refactor my code after issues are fixed.