. // }}} namespace Plugin\Favourite\Controller; use App\Core\DB\DB; use App\Core\Event; use App\Util\Common; use Symfony\Component\HttpFoundation\Request; class Favourite { public function favourites(Request $request) { $actor_id = Common::ensureLoggedIn()->getId(); $notes = DB::dql('select f from Plugin\Favourite\Entity\Favourite f ' . 'where f.gsactor_id = :id ' . 'order by f.created DESC', ['id' => $actor_id]); Event::handle('FormatNoteList', [$notes, &$note_out]); return [ '_template' => 'network/public.html.twig', 'notes' => $notes_out, ]; } /** * Reverse favourites stream * * @param Request $request * * @throws \App\Util\Exception\NoLoggedInUser user not logged in * * @return array template */ public function reverseFavourites(Request $request) { $actor_id = Common::ensureLoggedIn()->getId(); $notes = DB::dql('select n from App\Entity\Note n, Plugin\Favourite\Entity\Favourite f ' . 'where n.id = f.note_id ' . 'and f.gsactor_id != :id ' . 'and n.gsactor_id = :id ' . 'order by f.created DESC' , ['id' => $actor_id]); Event::handle('FormatNoteList', [$notes, &$notes_out]); return [ '_template' => 'network/reversefavs.html.twig', 'notes' => $notes, ]; } }