SHARE
TWEET

Untitled

a guest Jan 4th, 2013 17 Never
  1. cake consoleCommand databaseConfig
  2.        
  3. class AppModel extends Model
  4.        
  5. private function _before() {
  6.  
  7.     $conn = Configure::read('dbConnection');
  8.     if(!empty($conn))
  9.         $this->setDataSource($conn);
  10. }
  11.  
  12. public function beforeValidate($options = array()) {
  13.     $this->_before();
  14.     parent::beforeValidate();
  15. }
  16.  
  17. public function beforeDelete($bool = true) {
  18.     $this->_before();
  19.     parent::beforeDelete($bool);
  20. }
  21.  
  22. public function beforeFind($queryData) {
  23.     $this->_before();
  24.     parent::beforeFind($queryData);
  25. }
  26.  
  27. public function beforeSave($options=array()) {
  28.     $this->before();
  29.     parent::beforeSave($options);
  30. }
RAW Paste Data
Top