Skip to content

Commit 8026655

Browse files
authored
Merge pull request #98 from GertjanRoke/master
Added fallback on getKey method.
2 parents fb53e1e + b38674a commit 8026655

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/MonologHandler.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ protected function addContext(array $context = [])
4444
if (is_object($data)) {
4545
if (isset($data->id)) {
4646
$person['id'] = $data->id;
47+
} elseif (method_exists($data, 'getKey')) {
48+
$person['id'] = $data->getKey();
49+
}
50+
51+
if (isset($person['id'])) {
4752
if (isset($data->username)) {
4853
$person['username'] = $data->username;
4954
}

0 commit comments

Comments
 (0)