I'm trying to figure out ACL, and so I'm trying to work through the tutorial in the book (Cake 1.3, by the way).
I've created the database tables (aros,acos,aros_acos). As soon as I try to include the Acl component in my AppController, however, I get a fatal error when I try to access any page:
Fatal Error (256): ConnectionManager::getDataSource - Non-existent data source [CORE/cake/libs/model/connection_manager.php, line 102]
In my AppController:
public $components = array('Auth','Session','RequestHandler','Acl');
Removing Acl from the components array makes everything work again.
The errors disappear when I comment out some code in my AppController. Here is the code - the lines commented out are the culprits. AppModel::slugList() is a custom function that just does a find query based on a slug. It works fine, at least until Acl is included.
if ($this->modelClass != 'Country'){
$this->loadModel('Country');
}
if ($this->modelClass != 'Category'){
$this->loadModel('Category');
}
$this->Session->write('Country',1);
$this->Session->write('City',1);
$_countryId = $this->Session->read('Country');
//$_countries = $this->Country->slugList();
$_cityId = $this->Session->read('City');
//$_cities = $this->Country->City->slugList();
Edit - also, three notices appear:
Notice (8): Trying to get property of non-object [CORE/cake/libs/model/datasources/dbo_source.php, line 813]
Notice (8): Trying to get property of non-object [CORE/cake/libs/model/datasources/dbo_source.php, line 838]
Notice (8): Trying to get property of non-object [CORE/cake/libs/model/datasources/dbo_source.php, line 841]