where('createdFor', $request->header->account) ->where('seenAt', null) ->where('createdAt', $now, '<') // Don't show pre-created notifications ->sort('createdAt', OrderType::ASC) ->execute(); foreach ($notifications as $notification) { $new = clone $notification; $new->seenAt = $now; $this->updateModel($request->header->account, $notification, $new, NotificationMapper::class, 'notification', $request->getOrigin()); } $this->createStandardUpdateResponse($request, $response, []); } }