$customer = $customer_mapper->getCustomerById($customer_data['CustomerNumber']); $this->logger->info("Updating customer " . $customer->getName()); $customer->setName($customer_data['Name']); $customer->setAddress($customer_data['Address']); $customer->setPhoneNumber($customer_data['Telephone']); $customer_mapper->update($customer); $response = $response->withRedirect("/index.php/customers"); return $response; }); // Delete Customer $app->get('/customer/{id}/delete', function ($request, $response, $args) { $customer_id = (int) $args['id']; $customer_mapper = new CustomerMapper($this->db); $customer = $customer_mapper->getCustomerById($customer_id); $this->logger->info("Customer retrieved " . $customer->getName()); $customer_mapper->delete($customer); $response = $response->withRedirect("/index.php/customers"); return $response; }); /**********************DEPARTMENTS**********************/ // Departments $app->get('/departments', function ($request, $response, $args) { $this->logger->info("Departments page"); $mapper = new DepartmentMapper($this->db); $departments = $mapper->getDepartments(); return $this->renderer->render($response, 'department/departments.phtml', [$args, "departments" => $departments]); }); // New Department $app->get('/department/new', function ($request, $response, $args) { $this->logger->info("Creating new department"); return $this->renderer->render($response, 'department/department.phtml', $args);