$mapper = new DependantMapper($this->db); $dependant = $mapper->getDependantById($data['SSN']); $this->logger->info("POST Edit Dependant " . $dependant->getName()); $dependant->setName($data['Name']); $dependant->setDob($data['DateOfBirth']); $mapper->update($dependant); $response = $response->withRedirect("/index.php/dependants"); return $response; }); // Delete Dependant $app->get('/dependant/{id}/delete', function ($request, $response, $args) { $id = (int) $args['id']; $mapper = new DependantMapper($this->db); $dependant = $mapper->getDependantById($id); $this->logger->info("Deleting dependant " . $id); $mapper->delete($dependant); $response = $response->withRedirect("/index.php/dependants"); return $response; }); /**********************EMPLOYEE**********************/ // Employees $app->get('/employees', function ($request, $response, $args) { $this->logger->info("Employees page"); $employee_mapper = new EmployeeMapper($this->db); $employees = $employee_mapper->getEmployees(); return $this->renderer->render($response, 'employee/employees.phtml', [$args, "employees" => $employees]); }); // New Employee $app->get('/employee/new', function ($request, $response, $args) { $this->logger->info("Creating new employee"); $department_mapper = new DepartmentMapper($this->db);