Update DatabaseSession.php

To prevent error: "Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous" when using a custom Session object in relationship with another object (belongsTo <-| hasMany)
This commit is contained in:
thomasv 2015-09-10 00:25:39 +02:00
parent 6722a8d8ea
commit 1dbb6dd0e4

View file

@ -90,7 +90,7 @@ class DatabaseSession implements CakeSessionHandlerInterface {
*/
public function read($id) {
$row = $this->_model->find('first', array(
'conditions' => array($this->_model->primaryKey => $id)
'conditions' => array($this->_model->alias . '.' . $this->_model->primaryKey => $id)
));
if (empty($row[$this->_model->alias]['data'])) {