Last active
August 29, 2015 14:01
-
-
Save azrad/e6e2441719af56a42e5a to your computer and use it in GitHub Desktop.
DummySource for CakePHP 2.+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// store in App/Model/Book.php | |
App::uses('AppModel', 'Model'); | |
class Book extends AppModel | |
{ | |
public $useTable = false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// store in App/Config/database.php | |
class DATABASE_CONFIG { | |
public $default = array( | |
'datasource' => 'DummySource' | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// store in App/Model/DataSource/DummySource.php | |
class DummySource extends DataSource | |
{ | |
function connect() | |
{ | |
$this->connected = true; | |
return $this->connected; | |
} | |
function disconnect() | |
{ | |
$this->connected = false; | |
return !$this->connected; | |
} | |
function isConnected() | |
{ | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment