|
|
@@ -18,7 +18,7 @@
|
|
|
namespace Cake\Network\Session;
|
|
|
|
|
|
use Cake\ORM\Entity;
|
|
|
-use Cake\ORM\Locator\TableLocator;
|
|
|
+use Cake\ORM\Locator\LocatorAwareTrait;
|
|
|
use SessionHandlerInterface;
|
|
|
|
|
|
/**
|
|
|
@@ -26,6 +26,7 @@ use SessionHandlerInterface;
|
|
|
*/
|
|
|
class DatabaseSession implements SessionHandlerInterface
|
|
|
{
|
|
|
+ use LocatorAwareTrait;
|
|
|
|
|
|
/**
|
|
|
* Reference to the table handling the session data
|
|
|
@@ -50,7 +51,10 @@ class DatabaseSession implements SessionHandlerInterface
|
|
|
*/
|
|
|
public function __construct(array $config = [])
|
|
|
{
|
|
|
- $tableLocator = isset($config['tableLocator']) ? $config['tableLocator'] : TableLocator::getInstance();
|
|
|
+ if (isset($config['tableLocator'])) {
|
|
|
+ $this->setTableLocator($config['tableLocator']);
|
|
|
+ }
|
|
|
+ $tableLocator = $this->getTableLocator();
|
|
|
|
|
|
if (empty($config['model'])) {
|
|
|
$config = $tableLocator->exists('Sessions') ? [] : ['table' => 'sessions'];
|