mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Make eventdb optional
This commit is contained in:
parent
512f21c1a8
commit
efef446220
1 changed files with 7 additions and 1 deletions
|
@ -47,7 +47,7 @@ class Notifications
|
|||
{
|
||||
$db = $this->getEDB(false);
|
||||
if(!$db)
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
$results = $db->query($this->getQuery($user, true, $offset, $archived));
|
||||
|
||||
|
@ -56,6 +56,12 @@ class Notifications
|
|||
|
||||
function getNotificationsByUser(User $user, int $offset, bool $archived = false, int $page = 1, ?int $perPage = NULL): \Traversable
|
||||
{
|
||||
$db = $this->getEDB(false);
|
||||
if(!$db) {
|
||||
yield from [];
|
||||
return;
|
||||
}
|
||||
|
||||
$results = $this->getEDB()->query($this->getQuery($user, false, $offset, $archived, $page, $perPage));
|
||||
foreach($results->fetchAll() as $notif) {
|
||||
$originModel = $this->getModel($notif->originModelType, $notif->originModelId);
|
||||
|
|
Loading…
Reference in a new issue