public function commit() { //iniciando o retorno padrao $HttpReturnResult = new HttpResult(); $CategoryVO = new CategoryVO(); if (!isset($_POST["category_id"]) || $_POST["category_id"] == NULL) { $_POST["category_id"] = 2; } $_POST["active"] = 1; $CategoryVO->setFetchArray($_POST); $id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id")); if ($id > 0) { $CategoryVO->setId($id); } $ResultValidate = $CategoryVO->validate(); $resultPage = new DefaultPage(); //Debug::print_r($ResultValidate); exit(); if ($ResultValidate->success) { $ReturnResult = $CategoryVO->commit(); //Debug::print_r($ReturnResult);exit(); if ($ReturnResult->success) { Navigation::redirect("backend/category/show"); } else { $resultPage->returnResult = $ReturnResult; } } else { $resultPage->returnResult = $ResultValidate; } $HttpReturnResult->setHttpContentResult($resultPage); return $HttpReturnResult; }
public function commit() { //iniciando o retorno padrao $HttpReturnResult = new HttpResult(); $CategoryVO = new CategoryVO(); if ($_POST["category_id"] == NULL) { $_POST["category_id"] = 0; } $_POST["active"] = 1; $CategoryVO->setFetchArray($_POST); $ResultValidate = $CategoryVO->validate(); $resultPage = new DefaultPage(); //Debug::print_r($ResultValidate); exit(); if ($ResultValidate->success) { $ReturnResult = $CategoryVO->commit(); //Debug::print_r($ReturnResult);exit(); if ($ReturnResult->success) { Navigation::redirect("admin/category/select"); } else { $resultPage->returnResult = $ReturnResult; } } else { $resultPage->returnResult = $ResultValidate; } $HttpReturnResult->setHttpContentResult($resultPage); return $HttpReturnResult; }
/** * precisa enviar uma array dentro dos padr�es dessa VO, pode enviar diretamente o $_POST * @param (array) $array_dados * @return void */ function setFetchArray($array_dados) { $this->setDescription(DataHandler::getValueByArrayIndex($array_dados, "description")); parent::setFetchArray($array_dados); }