function customeraddAction(Request $request) { // This our DataBase Object! //Creating Report Table for customer $customertable = new RT(); /* * Creating customer Form * Check forms/CustomerForm.php */ $customerform = new CF(); //persistence($request) method keep the data through requests $customerform->persistence($request); //$errors variable is going to be an array to save all the errors $errors = ''; $success = ''; //now we check is the form has been summitted if ($request->isMethod('POST')) { //Validating the form $customerform->validate(); /* * storeForm($form) save the data from a form to the DB * return an execption if it found a error */ $e = DB::storeForm($customerform); if (isset($e)) { $errors = $e->getMessage(); } else { $success = 'Data Saved!'; } } /* return the view/example/customerform.html template also we send the customerform as parameter and the errors variable */ return $this->render('example/customerform', array('url' => $this->generateURL('customerform'), 'newurl' => $this->generateURL('customerform'), 'form' => $customerform, 'error' => $errors, 'success' => $success, 'table' => $customertable->createReport())); }
function indexAction() { $report = new CT(); $report->setTitle('This is gnna be the tittle'); return $this->render('report', array('reporttable' => $report->createReport())); }