From: Mikael Nordfeldth Date: Wed, 9 Sep 2015 15:03:52 +0000 (+0200) Subject: Let's handle notice dataobjects instead, despite fetching twice from db X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=52de57e2f6aacd1d5f89d4e1617e8a52af598680;p=quix0rs-gnu-social.git Let's handle notice dataobjects instead, despite fetching twice from db Actually the original object should be fixed here, but we'll handle the FIXME's later. --- diff --git a/lib/apiaction.php b/lib/apiaction.php index fae8f33d0e..8c1b4c67e7 100644 --- a/lib/apiaction.php +++ b/lib/apiaction.php @@ -795,7 +795,13 @@ class ApiAction extends Action 'xmlns:statusnet' => 'http://status.net/schema/api/1/')); if (is_array($notice)) { - $notice = new ArrayWrapper($notice); + //FIXME: make everything calling showJsonTimeline use only Notice objects + common_debug('ArrayWrapper avoidance in progress! Beep boop, make showJsonTimeline only receive Notice objects!'); + $ids = array(); + foreach ($notice as $n) { + $ids[] = $n->getID(); + } + $notice = Notice::multiGet('id', $ids); } while ($notice->fetch()) { @@ -851,7 +857,13 @@ class ApiAction extends Action $this->element('ttl', null, '40'); if (is_array($notice)) { - $notice = new ArrayWrapper($notice); + //FIXME: make everything calling showJsonTimeline use only Notice objects + common_debug('ArrayWrapper avoidance in progress! Beep boop, make showJsonTimeline only receive Notice objects!'); + $ids = array(); + foreach ($notice as $n) { + $ids[] = $n->getID(); + } + $notice = Notice::multiGet('id', $ids); } while ($notice->fetch()) { @@ -895,7 +907,13 @@ class ApiAction extends Action $this->element('subtitle', null, $subtitle); if (is_array($notice)) { - $notice = new ArrayWrapper($notice); + //FIXME: make everything calling showJsonTimeline use only Notice objects + common_debug('ArrayWrapper avoidance in progress! Beep boop, make showJsonTimeline only receive Notice objects!'); + $ids = array(); + foreach ($notice as $n) { + $ids[] = $n->getID(); + } + $notice = Notice::multiGet('id', $ids); } while ($notice->fetch()) {