Guest User

Untitled

a guest
Jul 6th, 2012
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  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();
Advertisement
Add Comment
Please, Sign In to add comment