This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 0.62 KB  |  views: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data