Permalink
Browse files

Fixing the DatabaseSession to work with models that use a different p…

…rimary key field than id.
  • Loading branch information...
1 parent 87d3a2e commit 98e29b7246ff490ff2affed25e00c4e73444d32d @burzum burzum committed Jun 15, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/Cake/Model/Datasource/Session/DatabaseSession.php
@@ -110,7 +110,10 @@ public function write($id, $data) {
return false;
}
$expires = time() + (Configure::read('Session.timeout') * 60);
- return ClassRegistry::getObject('Session')->save(compact('id', 'data', 'expires'));
+ $Session = ClassRegistry::getObject('Session');
+ $record = compact('id', 'data', 'expires');
+ $record[$Session->primaryKey] = $id;
+ return $Session->save($record);
}
/**

0 comments on commit 98e29b7

Please sign in to comment.