CakePHP 1.3 without database
To use the CakePHP 1.3 without database is pretty simple, we must create a new datasource, I’ll call it “Without”, so let’s go do it.
Firstly we must set the DATABASE_CONFIG, go to the config folder and edit the database.php:
1 2 3 4 5 6 | < ?php class DATABASE_CONFIG { var $default = array('driver' => 'without'); } ?> |
We defined there the driver to “without”, so let’s create the dbo_without.php inside the folder models/datasources/ with the code below:
1 2 3 4 5 6 7 8 9 | < ?php class DboWithout extends DataSource { public function isConnected() { return true; } } ?> |
Just it, we just need create a method called isConnected returning it true, compared with the version 1.2 is more easy.
in order to remove the notice warning. specify the ‘database’ in the array.
var $default = array(‘driver’ => ‘without’,'database’=>’none’);