public function index() { if (!isset($_SESSION['userId'])) { header('Location: /php_project/application/public/'); exit; } $this->getUser(); $productDb = new \Models\Product(); $userProducts = $productDb->getProductsByBuyer($_SESSION['userId']); $data = array(); $data[] = $this->user; $data[] = $userProducts; $this->view->appendToLayout('body', 'profile'); $this->view->display('layouts.default', $data); }