diff --git a/app/controllers/my_institutes.php b/app/controllers/my_institutes.php index 0bdff852d75e51e18692060ae8e3faf0cf8192db..f61ad37d423497ac786161068c3ca6b8cc35cecd 100644 --- a/app/controllers/my_institutes.php +++ b/app/controllers/my_institutes.php @@ -61,9 +61,15 @@ class MyInstitutesController extends AuthenticatedController public function tabularasa_action($timestamp = null) { $institutes = MyRealmModel::getMyInstitutes(); - foreach ($institutes as $index => $institut) { - MyRealmModel::setObjectVisits($institutes[$index], $institut['institut_id'], $this->user_id, $timestamp); - } + + // This is ugly but since the above does not return object, we need to + // load the institutes again + Institute::findEachMany( + function (Institute $institute) use ($timestamp) { + MyRealmModel::setObjectVisits($institute, $this->user_id, $timestamp); + }, + array_column($institutes, 'institut_id') + ); PageLayout::postSuccess(_('Alles als gelesen markiert!')); $this->redirect('my_institutes/index');