Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 6th, 2012  |  syntax: None  |  size: 0.36 KB  |  hits: 11  |  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. Proper way to inject Session data before model save/validate in CakePHP 1.3?
  2. if (!empty($this->data)) {
  3.     $this->Model->create();
  4.     $this->data['Model']['agent_id'] = $this->Auth->user('id');
  5.     if ($this->Model->save($this->data)) {
  6.          // success
  7.     }
  8. }
  9.        
  10. // in your Model.php
  11. App::import('Model', 'CakeSession');
  12. $session = new CakeSession();