Fixing the DatabaseSession to work with models that use a different primary key field than id.

This commit is contained in:
Florian Krmer 2011-06-15 22:56:55 +02:00
parent 87d3a2ef19
commit 98e29b7246

View file

@ -110,7 +110,10 @@ class DatabaseSession implements CakeSessionHandlerInterface {
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);
}
/**