Fix API result, add PHPDoc and cleanup object construction

Fix missing getters
fix data array
fix missing "$" for template-variables
Remove lazy-loaded parent notification instance (for now..)
This commit is contained in:
nupplaPhil 2020-01-25 20:00:58 +01:00
parent 4c5856da2b
commit 74f3a2f90c
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
7 changed files with 203 additions and 218 deletions

View file

@ -5909,16 +5909,21 @@ function api_friendica_notification($type)
$notifications = DI::notification()->select([], ['order' => ['seen' => 'ASC', 'date' => 'DESC'], 'limit' => 50]);
if ($type == "xml") {
$xmlnotes = [];
$xmlnotes = false;
if (!empty($notifications)) {
foreach ($notifications as $notification) {
$xmlnotes[] = ["@attributes" => $notification->toArray()];
}
}
$notifications = $xmlnotes;
$result = $xmlnotes;
} elseif (count($notifications) > 0) {
$result = $notifications->getArrayCopy();
} else {
$result = false;
}
return api_format_data("notes", $type, ['note' => $notifications->getArrayCopy()]);
return api_format_data("notes", $type, ['note' => $result]);
}
/**