Permalink
Browse files

Merge pull request #121 from burzum/98e29b7246ff490ff2af

Fixing the DatabaseSession to work with models that use a different primary key field than id.
  • Loading branch information...
2 parents f4e598f + 98e29b7 commit a32506593c948fe56f6d7b524f1178fb37800533 @lorenzo lorenzo 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 a325065

Please sign in to comment.