pdo = $db; } private function execSQL($sql, $conditions){ $stmt = $this->pdo->prepare($sql); $stmt->execute($conditions); $data = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); return json_encode($data); } private function execSQLNoData($sql, $conditions){ $stmt = $this->pdo->prepare($sql); $stmt->execute($conditions); $stmt->closeCursor(); } private function execSQLNoJsonReturn($sql, $conditions){ $stmt = $this->pdo->prepare($sql); $stmt->execute($conditions); $data = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); return $data; } public function getCurrentUserMailBoxId(string $currentUserId ) { $sql = 'SELECT mail_mailbox.id as mail_box_id FROM oc_mail_accounts as mail_account LEFT JOIN oc_mail_mailboxes as mail_mailbox ON mail_account.id = mail_mailbox.account_id WHERE mail_account.user_id = ? AND mail_mailbox.name = ?'; $result = $this->execSQLNoJsonReturn($sql, [$currentUserId,"INBOX"]); if(!empty($result)){ return $result[0]['mail_box_id']; } return null; } }