Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…rimary key field than id.
  • Loading branch information...
commit 98e29b7246ff490ff2affed25e00c4e73444d32d 1 parent 87d3a2e
@burzum burzum authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/Cake/Model/Datasource/Session/DatabaseSession.php
View
5 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);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.