I was looking at this link and it mentions to put INIT(); into the object so when ever you create the object it would auto init();
http://oreilly.com/pub/a/javascript/2003/09/24/coldfusion_tips.html
So if I do this below as my employeeService and
/*
- Employee Service
-
@accessors true
*/
component employeeService output=“false” {
init();
/*
- init
*/
function init() output=“false” {
var oEmployee = createObject(‘component’, ‘testObjects.model.employee.employee’).init();
return oEmployee;
}
}
My Employee Object
/*
- Employee
-
@accessors true
/
component employee output=“false” extends=“testObjects.model.user.user” {
/ properties */
property name=“rank” type=“string”;
/*
- init
*/
function init() output=“false” {
super.init();
//department=“HR”;
return this;
}
}
and then in my test page put this call to it.
session.oEmployeeService = createObject('component', 'testObjects.model.employee.employeeService');Am I misunderstanding or shouldn’t it auto init?
I even copied their code.
<cfset init()>
<cfset session.myCart = createObject(“component”,“testObjects.model.shoppingCart”)>
It still does not seem to work.