controllers/NotificationsController.php
private function getNotification($id)
    {
        /** @var Notification $notification */
        $class = $this->notificationClass;
        $notification = $class::findOne($id);
        if (!$notification) {
            throw new HttpException(404, "Unknown notification");
        }

        if ($notification->user_id != $this->user_id) {
            throw new HttpException(500, "Not your notification");
        }

        return $notification;
    }
private function getNotification($id)
    {
        /** @var Notification $notification */
        $class = $this->notificationClass;
        $notification = $class::findOne($id);
        if (!$notification) {
            throw new HttpException(404, "Unknown notification");
        }

        if ($notification->user_id != $this->user_id) {
            throw new HttpException(500, "Not your notification");
        }

        return $notification;
    }
private function getNotification ( $ id ) { /** @var Notification $notification */ $ class = $ this -> notificationClass ; $ notification = $ class :: findOne ( $ id ) ; if ( ! $ notification ) { throw new HttpException ( 404 , "Unknown notification" ) ; } if ( $ notification -> user_id != $ this -> user_id ) { throw new HttpException ( 500 , "Not your notification" ) ; } return $ notification ; }
Gets a notification by id

@param int $id The notification id
@return Notification
@throws HttpException Throws an exception if the notification is not
found, or if it don't belongs to the logged in user
Gets a notification by id