Hello,
I’m trying to create a simple CRUD app in ColdBox.
I have in my handler Contacts.cfc with all the methods.
I have in my models Contacts.cfc, ContactsService.cfc and ContactsDAO.cfc.
The problem is that in ContactsDAO.cfc, ColdBox does not recognise the DSN, even though it has been created in myCFAdministrator. I get the following erre:Builder.DSLDependencyNotFoundException
The code is as follows:
`
Enter code here./**
- I am a new Model Object
*/
component singleton accessors=“true”{
// Dependency Injection
property name=“dsn” inject=“coldbox:datasource:coldbox_test”;
/**
- Constructor
*/
ContactDAO function init() {
return this;
}
query function getAll(){
var q = new Query(datasource="#dsn#",sql=“SELECT * FROM contacts”);
return q.execute().getResult();
}
query function getContact(required contactID){
var q = new Query(datasource="#dsn#",sql=“SELECT * FROM contacts WHERE contact_id = :contactID”);
q.addParam(name=“contactID”,value=arguments.contactID,cfsqltype=“cf_sql_numeric”);
return q.execute().getResult();
}
/… ALL OTHER METHODS HERE FOR CRUD …/
}…
`
Any ideas as to how to fix this?
Thanks.