getAllCampaigns() is returning a null value, which is why rc.campaigns doesn’t exist.
Have you tried just dumping out a simple EntityLoad(“Campaign”), to make sure that the ORM stuff is working? Also does your Campaign entity have any relationships set up that mave be causing an issue?
Can you also say which version of ColdBox you’re running as this might have been fixed in SVN, but not in the build you’re running.
yes it works with the virtual service but using the base ORM no I just
get an empty array
current code
Handler
component extends="coldbox.system.EventHandler" output="false"{
property name="campaignService" inject="entityService";
/* index handler dashboard */
function index(event){
var rc = event.getCollection();//get scope
var campaign = entityLoad("campaign");
writeDump(campaign);
abort;
rc.campaigns = campaignService.getAllCampaigns();
event.setView("dashboard/index");//load view
}
campaignService.cfc
component extends="BaseORMService"{
public campaignService function init(){
super.init(useQueryCaching=true);
return this;
}
any function getAllCampaigns() output=false{
var campaign = "";
campaign = ORMService.getAll("campaign");
return campaign;
}
strange think is anything I get from the campaignService always
returns that error event it I hard code a value and just try to return
that!
so for example say i do the following in my service...
any function getAllCampaigns() output=false{
var campaign = "1";
return campaign;
}
I get
Element CAMPAIGNS is undefined in a CFML structure referenced as part
of an expression.
The error occurred in C:\inetpub\wwwroot\cms.yourbrandreality.co.uk
\coldbox\system\includes\panels\CollectionPanel.cfm: line 21
Called from C:\inetpub\wwwroot\cms.yourbrandreality.co.uk\coldbox
\system\includes\Debug.cfm: line 253
Called from C:\inetpub\wwwroot\cms.yourbrandreality.co.uk\coldbox
\system\web\services\DebuggerService.cfc: line 201
Called from C:\inetpub\wwwroot\cms.yourbrandreality.co.uk\coldbox
\system\Coldbox.cfc: line 321
Called from C:\inetpub\wwwroot\cms.yourbrandreality.co.uk
\Application.cfc: line 59
you have
property name=“campaignService” inject=“entityService”;
That means that it will create a VIRTUAL file for you and inject it as campaignService. This virtual file is a vanilla base orm service. However, you have created your OWN service called campaignService that templates out the base orm service. So you need to inject THAT object and not the virtual objects.