Guest User

Untitled

a guest
Jan 4th, 2013
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment