Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jturbide committed Feb 21, 2024
1 parent f98a165 commit 3626930
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Db/Events/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Phalcon\Events\EventInterface;
use Phalcon\Mvc\ModelInterface;
use Zemit\Di\Injectable;
use Zemit\Models\Interfaces\SessionInterface;

/**
* @todo review
Expand All @@ -31,11 +32,7 @@ public function beforeQuery(EventInterface $event, AbstractAdapter $connection):

// deactivate logger
$this->inProgress = true;

$session = $this->identity->getSession();
assert($session instanceof ModelInterface);

$sessionId = $session->readAttribute('id');
$sessionId = $this->identity->getSession()?->getId();
$userId = $this->identity->getUserId() ?: null;
$userAsId = $this->identity->getUserAsId() ?: null;

Expand All @@ -44,10 +41,14 @@ public function beforeQuery(EventInterface $event, AbstractAdapter $connection):
'sessionId' => $sessionId,
'userId' => $userId,
'userAsId' => $userAsId,
'event' => [
'type' => $event->getType(),
'data' => $event->getData(),
],
'meta' => [
// 'identity' => $this->identity->getIdentity(),
'sqlStatement' => $connection->getSQLStatement(),
'sqlVariables' => $connection->getSqlVariables(),
'sqlVariables' => $connection->getSQLVariables(),
],
]);

Expand Down

0 comments on commit 3626930

Please sign in to comment.