Cakephp actually try to connect to a database no matter that you don’t use a table
so using this
class MyModel extends AppModel {
public $useTable = false;
}
it will be just a mistake , creating application on cakephp is piece of cake. Here are some steps you have to do in order to start developing without a database.
- Create fake dbo source
Create file DboFakeDboSource.php in app/Model/Datasource/Dbo/ and put the following code in it
class DboFakeDboSource extends DboSource {
function connect() {
$this->connected = true;
return $this->connected;
}
function disconnect() {
$this->connected = false;
return !$this->connected;
}
}
- Set the default connection
The next step is to tell cakephp to use dbo source by default. Go and change default connection in database.php to be like this
var $default = array(
'driver' => 'FakeDboSource'
);
- Fine tuning the model
The third step is to be sure that $useTable = false; is included in every model, so add it in AppModel.php