当前位置: 首页>>代码示例>>PHP>>正文


PHP RequestUtil::GetBody方法代码示例

本文整理汇总了PHP中RequestUtil::GetBody方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestUtil::GetBody方法的具体用法?PHP RequestUtil::GetBody怎么用?PHP RequestUtil::GetBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RequestUtil的用法示例。


在下文中一共展示了RequestUtil::GetBody方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Update

 /**
  * API Method updates an existing User record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('iduser');
         $user = $this->Phreezer->Get('User', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $user->Iduser = $this->SafeGetVal($json, 'iduser', $user->Iduser);
         $user->Institution = $this->SafeGetVal($json, 'institution', $user->Institution);
         $user->Fullname = $this->SafeGetVal($json, 'fullname', $user->Fullname);
         $user->Username = $this->SafeGetVal($json, 'username', $user->Username);
         $user->Password = $this->SafeGetVal($json, 'password', $user->Password);
         $user->Notes = $this->SafeGetVal($json, 'notes', $user->Notes);
         $user->Code = $this->SafeGetVal($json, 'code', $user->Code);
         $user->Timezone = $this->SafeGetVal($json, 'timezone', $user->Timezone);
         $user->Lastlogin = date('Y-m-d H:i:s', strtotime($this->SafeGetVal($json, 'lastlogin', $user->Lastlogin)));
         $user->Status = $this->SafeGetVal($json, 'status', $user->Status);
         $user->Admin = $this->SafeGetVal($json, 'admin', $user->Admin);
         $user->Validate();
         $errors = $user->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Please check the form for errors', $errors);
         } else {
             $user->Save();
             $this->RenderJSON($user, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:arianestolfi,项目名称:digital,代码行数:37,代码来源:UserController.php

示例2: Update

 /**
  * API Method updates an existing Pedido record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('id');
         $pedido = $this->Phreezer->Get('Pedido', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $pedido->Id = $this->SafeGetVal($json, 'id', $pedido->Id);
         $pedido->Datacriacao = date('Y-m-d H:i:s', strtotime($this->SafeGetVal($json, 'datacriacao', $pedido->Datacriacao)));
         $pedido->Observacao = $this->SafeGetVal($json, 'observacao', $pedido->Observacao);
         $pedido->Dataentrega = date('Y-m-d H:i:s', strtotime($this->SafeGetVal($json, 'dataentrega', $pedido->Dataentrega)));
         $pedido->Valorfrete = $this->SafeGetVal($json, 'valorfrete', $pedido->Valorfrete);
         $pedido->Valordesconto = $this->SafeGetVal($json, 'valordesconto', $pedido->Valordesconto);
         $pedido->Valortotal = $this->SafeGetVal($json, 'valortotal', $pedido->Valortotal);
         $pedido->Statuspedido = $this->SafeGetVal($json, 'statuspedido', $pedido->Statuspedido);
         $pedido->Formapagamento = $this->SafeGetVal($json, 'formapagamento', $pedido->Formapagamento);
         $pedido->Vendedor = $this->SafeGetVal($json, 'vendedor', $pedido->Vendedor);
         $pedido->Cliente = $this->SafeGetVal($json, 'cliente', $pedido->Cliente);
         $pedido->Enderecoentrega = $this->SafeGetVal($json, 'enderecoentrega', $pedido->Enderecoentrega);
         $pedido->Itempedido = $this->SafeGetVal($json, 'itempedido', $pedido->Itempedido);
         $pedido->Validate();
         $errors = $pedido->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Please check the form for errors', $errors);
         } else {
             $pedido->Save();
             $this->RenderJSON($pedido, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:ronyelias,项目名称:pizzaria,代码行数:39,代码来源:PedidoController.php

示例3: Update

 /**
  * API Method updates an existing Itemdescription record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('id');
         $itemdescription = $this->Phreezer->Get('Itemdescription', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $itemdescription->Id = $this->SafeGetVal($json, 'id', $itemdescription->Id);
         $itemdescription->Item = $this->SafeGetVal($json, 'item', $itemdescription->Item);
         $itemdescription->Abstracttext = $this->SafeGetVal($json, 'abstracttext', $itemdescription->Abstracttext);
         $itemdescription->Accrual = $this->SafeGetVal($json, 'accrual', $itemdescription->Accrual);
         $itemdescription->Appraisaldesstructionschedulling = $this->SafeGetVal($json, 'appraisaldesstructionschedulling', $itemdescription->Appraisaldesstructionschedulling);
         $itemdescription->Arrangement = $this->SafeGetVal($json, 'arrangement', $itemdescription->Arrangement);
         $itemdescription->Broadcastmethod = $this->SafeGetVal($json, 'broadcastmethod', $itemdescription->Broadcastmethod);
         $itemdescription->Era = $this->SafeGetVal($json, 'era', $itemdescription->Era);
         $itemdescription->Fromcorporate = $this->SafeGetVal($json, 'fromcorporate', $itemdescription->Fromcorporate);
         $itemdescription->Frompersonal = $this->SafeGetVal($json, 'frompersonal', $itemdescription->Frompersonal);
         $itemdescription->Geographiccoodnates = $this->SafeGetVal($json, 'geographiccoodnates', $itemdescription->Geographiccoodnates);
         $itemdescription->Geographicname = $this->SafeGetVal($json, 'geographicname', $itemdescription->Geographicname);
         $itemdescription->Label = $this->SafeGetVal($json, 'label', $itemdescription->Label);
         $itemdescription->Language = $this->SafeGetVal($json, 'language', $itemdescription->Language);
         $itemdescription->Mediapresentation = $this->SafeGetVal($json, 'mediapresentation', $itemdescription->Mediapresentation);
         $itemdescription->Movement = $this->SafeGetVal($json, 'movement', $itemdescription->Movement);
         $itemdescription->Other = $this->SafeGetVal($json, 'other', $itemdescription->Other);
         $itemdescription->Period = $this->SafeGetVal($json, 'period', $itemdescription->Period);
         $itemdescription->Periodicity = $this->SafeGetVal($json, 'periodicity', $itemdescription->Periodicity);
         $itemdescription->Preservationstatus = $this->SafeGetVal($json, 'preservationstatus', $itemdescription->Preservationstatus);
         $itemdescription->Scope = $this->SafeGetVal($json, 'scope', $itemdescription->Scope);
         $itemdescription->Style = $this->SafeGetVal($json, 'style', $itemdescription->Style);
         $itemdescription->Subject = $this->SafeGetVal($json, 'subject', $itemdescription->Subject);
         $itemdescription->Tableofcontents = $this->SafeGetVal($json, 'tableofcontents', $itemdescription->Tableofcontents);
         $itemdescription->Targetaudience = $this->SafeGetVal($json, 'targetaudience', $itemdescription->Targetaudience);
         $itemdescription->Tocorporate = $this->SafeGetVal($json, 'tocorporate', $itemdescription->Tocorporate);
         $itemdescription->Topersonal = $this->SafeGetVal($json, 'topersonal', $itemdescription->Topersonal);
         $itemdescription->Validate();
         $errors = $itemdescription->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Please check the form for errors', $errors);
         } else {
             $itemdescription->Save();
             $this->RenderJSON($itemdescription, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:arianestolfi,项目名称:digital,代码行数:53,代码来源:ItemdescriptionController.php

示例4: Update

 /**
  * API Method updates an existing Iteminscription record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('d');
         $iteminscription = $this->Phreezer->Get('Iteminscription', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $iteminscription->D = $this->SafeGetVal($json, 'd', $iteminscription->D);
         $iteminscription->Tem = $this->SafeGetVal($json, 'tem', $iteminscription->Tem);
         $iteminscription->Nscriptiontype = $this->SafeGetVal($json, 'nscriptiontype', $iteminscription->Nscriptiontype);
         $iteminscription->Nscriptiondescription = $this->SafeGetVal($json, 'nscriptiondescription', $iteminscription->Nscriptiondescription);
         $iteminscription->Nscriptionlocation = $this->SafeGetVal($json, 'nscriptionlocation', $iteminscription->Nscriptionlocation);
         $iteminscription->Validate();
         $errors = $iteminscription->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Please check the form for errors', $errors);
         } else {
             $iteminscription->Save();
             $this->RenderJSON($iteminscription, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:arianestolfi,项目名称:digital,代码行数:31,代码来源:IteminscriptionController.php

示例5: flush

 /**
  * Logs the request to the database, sends any cached output.
  * Also called on shutdown, to make sure we always log the request being handled.
  */
 static function flush()
 {
     if (OAuthRequestLogger::$logging) {
         OAuthRequestLogger::$logging = false;
         if (is_null(OAuthRequestLogger::$sent)) {
             // What has been sent to the user-agent?
             $data = ob_get_contents();
             if (strlen($data) > 0) {
                 ob_end_flush();
             } elseif (ob_get_level()) {
                 ob_end_clean();
             }
             $hs = headers_list();
             $sent = implode("\n", $hs) . "\n\n" . $data;
         } else {
             // The request we sent
             $sent = OAuthRequestLogger::$sent;
         }
         if (is_null(OAuthRequestLogger::$received)) {
             // Build the request we received
             $hs0 = self::getAllHeaders();
             $hs = array();
             foreach ($hs0 as $h => $v) {
                 $hs[] = "{$h}: {$v}";
             }
             // updated by j.hinkle to avoid re-reading php://input, which messes up PUT requests
             include_once 'verysimple/HTTP/RequestUtil.php';
             $body = RequestUtil::GetBody();
             // 				$fh    = @fopen('php://input', 'r');
             // 				if ($fh)
             // 				{
             // 					while (!feof($fh))
             // 					{
             // 						$s = fread($fh, 1024);
             // 						if (is_string($s))
             // 						{
             // 							$data .= $s;
             // 						}
             // 					}
             // 					fclose($fh);
             // 				}
             $received = implode("\n", $hs) . "\n\n" . $data;
         } else {
             // The answer we received
             $received = OAuthRequestLogger::$received;
         }
         // The request base string
         if (OAuthRequestLogger::$request_object) {
             $base_string = OAuthRequestLogger::$request_object->signatureBaseString();
         } else {
             $base_string = '';
         }
         // Figure out to what keys we want to log this request
         $keys = array();
         if (OAuthRequestLogger::$request_object) {
             $consumer_key = OAuthRequestLogger::$request_object->getParam('oauth_consumer_key', true);
             $token = OAuthRequestLogger::$request_object->getParam('oauth_token', true);
             switch (get_class(OAuthRequestLogger::$request_object)) {
                 // tokens are access/request tokens by a consumer
                 case 'OAuthServer':
                 case 'OAuthRequestVerifier':
                     $keys['ocr_consumer_key'] = $consumer_key;
                     $keys['oct_token'] = $token;
                     break;
                     // tokens are access/request tokens to a server
                 // tokens are access/request tokens to a server
                 case 'OAuthRequester':
                 case 'OAuthRequestSigner':
                     $keys['osr_consumer_key'] = $consumer_key;
                     $keys['ost_token'] = $token;
                     break;
             }
         }
         // Log the request
         if (OAuthRequestLogger::$store_log) {
             $store = OAuthStore::instance();
             $store->addLog($keys, $received, $sent, $base_string, OAuthRequestLogger::$note, OAuthRequestLogger::$user_id);
         }
         OAuthRequestLogger::$log[] = array('keys' => $keys, 'received' => $received, 'sent' => $sent, 'base_string' => $base_string, 'note' => OAuthRequestLogger::$note);
     }
 }
开发者ID:mymizan,项目名称:phreeze,代码行数:85,代码来源:OAuthRequestLogger.php

示例6: Update

 /**
  * API Method updates an existing Produto record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('id');
         $produto = $this->Phreezer->Get('Produto', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $produto->Id = $this->SafeGetVal($json, 'id', $produto->Id);
         $produto->Nome = $this->SafeGetVal($json, 'nome', $produto->Nome);
         $produto->Tamanho = $this->SafeGetVal($json, 'tamanho', $produto->Tamanho);
         $produto->Descricao = $this->SafeGetVal($json, 'descricao', $produto->Descricao);
         $produto->Valor = $this->SafeGetVal($json, 'valor', $produto->Valor);
         $produto->Validate();
         $errors = $produto->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Please check the form for errors', $errors);
         } else {
             $produto->Save();
             $this->RenderJSON($produto, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:ronyelias,项目名称:pizzaria,代码行数:31,代码来源:ProdutoController.php

示例7: Update

 /**
  * API Method updates an existing Palestra record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('idPalestra');
         $palestra = $this->Phreezer->Get('Palestra', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $palestra->IdPalestra = $this->SafeGetVal($json, 'idPalestra', $palestra->IdPalestra);
         $palestra->Nome = $this->SafeGetVal($json, 'nome', $palestra->Nome);
         $palestra->Data = date('Y-m-d H:i:s', strtotime($this->SafeGetVal($json, 'data', $palestra->Data)));
         $palestra->CargaHoraria = date('Y-m-d H:i:s', strtotime('1970-01-01 ' . $this->SafeGetVal($json, 'cargaHoraria', $palestra->CargaHoraria)));
         $palestra->ProprioEvento = $this->SafeGetVal($json, 'proprioEvento', $palestra->ProprioEvento);
         $palestra->IdEvento = $this->SafeGetVal($json, 'idEvento', $palestra->IdEvento);
         $palestra->IdModeloCertificado = $this->SafeGetVal($json, 'idModeloCertificado', $palestra->IdModeloCertificado);
         $palestra->Validate();
         $errors = $palestra->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Verifique erros no preenchimento do formulário', $errors);
         } else {
             $palestra->Save();
             $this->RenderJSON($palestra, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:joaoricardorm,项目名称:tcc,代码行数:33,代码来源:PalestraController.php

示例8: Update

 /**
  * API Method updates an existing Media record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('idmedia');
         $media = $this->Phreezer->Get('Media', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $media->Idmedia = $this->SafeGetVal($json, 'idmedia', $media->Idmedia);
         $media->Idhistory = $this->SafeGetVal($json, 'idhistory', $media->Idhistory);
         $media->Storage = $this->SafeGetVal($json, 'storage', $media->Storage);
         $media->Iddocumentation = $this->SafeGetVal($json, 'iddocumentation', $media->Iddocumentation);
         $media->Institution = $this->SafeGetVal($json, 'institution', $media->Institution);
         $media->Idreference = $this->SafeGetVal($json, 'idreference', $media->Idreference);
         $media->Mediatype = $this->SafeGetVal($json, 'mediatype', $media->Mediatype);
         $media->Mediaurl = $this->SafeGetVal($json, 'mediaurl', $media->Mediaurl);
         $media->Digitizationdate = date('Y-m-d H:i:s', strtotime($this->SafeGetVal($json, 'digitizationdate', $media->Digitizationdate)));
         $media->Digitizationresponsable = $this->SafeGetVal($json, 'digitizationresponsable', $media->Digitizationresponsable);
         $media->Polarity = $this->SafeGetVal($json, 'polarity', $media->Polarity);
         $media->Colorspace = $this->SafeGetVal($json, 'colorspace', $media->Colorspace);
         $media->Iccprofile = $this->SafeGetVal($json, 'iccprofile', $media->Iccprofile);
         $media->Xresolution = $this->SafeGetVal($json, 'xresolution', $media->Xresolution);
         $media->Yresolution = $this->SafeGetVal($json, 'yresolution', $media->Yresolution);
         $media->Thumbnail = $this->SafeGetVal($json, 'thumbnail', $media->Thumbnail);
         $media->Digitizationequipment = $this->SafeGetVal($json, 'digitizationequipment', $media->Digitizationequipment);
         $media->Format = $this->SafeGetVal($json, 'format', $media->Format);
         $media->Ispublic = $this->SafeGetVal($json, 'ispublic', $media->Ispublic);
         $media->Ordername = $this->SafeGetVal($json, 'ordername', $media->Ordername);
         $media->Sent = $this->SafeGetVal($json, 'sent', $media->Sent);
         $media->Exif = $this->SafeGetVal($json, 'exif', $media->Exif);
         $media->Textual = $this->SafeGetVal($json, 'textual', $media->Textual);
         $media->Sizemedia = $this->SafeGetVal($json, 'sizemedia', $media->Sizemedia);
         $media->Nameoriginal = $this->SafeGetVal($json, 'nameoriginal', $media->Nameoriginal);
         $media->Mainmedia = $this->SafeGetVal($json, 'mainmedia', $media->Mainmedia);
         $media->Mediadir = $this->SafeGetVal($json, 'mediadir', $media->Mediadir);
         $media->Thumbnaildir = $this->SafeGetVal($json, 'thumbnaildir', $media->Thumbnaildir);
         $media->Thumbnailurl = $this->SafeGetVal($json, 'thumbnailurl', $media->Thumbnailurl);
         $media->Validate();
         $errors = $media->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Please check the form for errors', $errors);
         } else {
             $media->Save();
             $this->RenderJSON($media, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:arianestolfi,项目名称:digital,代码行数:55,代码来源:MediaController.php

示例9: Update

 /**
  * API Method updates an existing Configuracao record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('idConfiguracao');
         $configuracao = $this->Phreezer->Get('Configuracao', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $configuracao->IdConfiguracao = $this->SafeGetVal($json, 'idConfiguracao', $configuracao->IdConfiguracao);
         $configuracao->NomeInstituicao = $this->SafeGetVal($json, 'nomeInstituicao', $configuracao->NomeInstituicao);
         $configuracao->ImagemLogo = $this->SafeGetVal($json, 'imagemLogo', $configuracao->ImagemLogo);
         $configuracao->Cnpj = $this->SafeGetVal($json, 'cnpj', $configuracao->Cnpj);
         $configuracao->Telefone = $this->SafeGetVal($json, 'telefone', $configuracao->Telefone);
         $configuracao->Validate();
         $errors = $configuracao->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Verifique erros no preenchimento do formulário', $errors);
         } else {
             $configuracao->Save();
             $this->RenderJSON($configuracao, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:joaoricardorm,项目名称:tcc,代码行数:31,代码来源:ConfiguracaoController.php

示例10: Update

 /**
  * API Method updates an existing Entregadores record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('id');
         $entregadores = $this->Phreezer->Get('Entregadores', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $entregadores->Id = $this->SafeGetVal($json, 'id', $entregadores->Id);
         $entregadores->Nome = $this->SafeGetVal($json, 'nome', $entregadores->Nome);
         $entregadores->Docreceita = $this->SafeGetVal($json, 'docreceita', $entregadores->Docreceita);
         $entregadores->Rg = $this->SafeGetVal($json, 'rg', $entregadores->Rg);
         $entregadores->Telefone = $this->SafeGetVal($json, 'telefone', $entregadores->Telefone);
         $entregadores->Empresa = $this->SafeGetVal($json, 'empresa', $entregadores->Empresa);
         $entregadores->Validate();
         $errors = $entregadores->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Please check the form for errors', $errors);
         } else {
             $entregadores->Save();
             $this->RenderJSON($entregadores, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:ronyelias,项目名称:pizzaria,代码行数:32,代码来源:EntregadoresController.php

示例11: Update

 /**
  * API Method updates an existing Search record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('idsearch');
         $search = $this->Phreezer->Get('Search', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $search->Idsearch = $this->SafeGetVal($json, 'idsearch', $search->Idsearch);
         $search->User = $this->SafeGetVal($json, 'user', $search->User);
         $search->Name = $this->SafeGetVal($json, 'name', $search->Name);
         $search->Info = $this->SafeGetVal($json, 'info', $search->Info);
         $search->Type = $this->SafeGetVal($json, 'type', $search->Type);
         $search->Datecreate = date('Y-m-d H:i:s', strtotime($this->SafeGetVal($json, 'datecreate', $search->Datecreate)));
         $search->Validate();
         $errors = $search->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Please check the form for errors', $errors);
         } else {
             $search->Save();
             $this->RenderJSON($search, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:arianestolfi,项目名称:digital,代码行数:32,代码来源:SearchController.php

示例12: Update

 /**
  * API Method updates an existing Imovel record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('id');
         $imovel = $this->Phreezer->Get('Imovel', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $imovel->Id = $this->SafeGetVal($json, 'id', $imovel->Id);
         $imovel->Titulo = $this->SafeGetVal($json, 'titulo', $imovel->Titulo);
         $imovel->Descricao = $this->SafeGetVal($json, 'descricao', $imovel->Descricao);
         $imovel->DataDisponibilidade = date('Y-m-d H:i:s', strtotime($this->SafeGetVal($json, 'dataDisponibilidade', $imovel->DataDisponibilidade)));
         $imovel->Imagem = $this->SafeGetVal($json, 'imagem', $imovel->Imagem);
         $imovel->Valor = $this->SafeGetVal($json, 'valor', $imovel->Valor);
         $imovel->EmailContato = $this->SafeGetVal($json, 'emailContato', $imovel->EmailContato);
         $imovel->TelefoneContato = $this->SafeGetVal($json, 'telefoneContato', $imovel->TelefoneContato);
         $imovel->TipoImovelId = $this->SafeGetVal($json, 'tipoImovelId', $imovel->TipoImovelId);
         $imovel->Validate();
         $errors = $imovel->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Por Favor, verifique os erros', $errors);
         } else {
             $imovel->Save();
             $this->RenderJSON($imovel, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:muralhaa,项目名称:imoveis,代码行数:35,代码来源:ImovelController.php

示例13: Update

 /**
  * API Method updates an existing Palestrante record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('idPalestrante');
         $palestrante = $this->Phreezer->Get('Palestrante', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $palestrante->IdPalestrante = $this->SafeGetVal($json, 'idPalestrante', $palestrante->IdPalestrante);
         $palestrante->Nome = $this->SafeGetVal($json, 'nome', $palestrante->Nome);
         $palestrante->Email = $this->SafeGetVal($json, 'email', $palestrante->Email);
         $palestrante->Cpf = $this->SafeGetVal($json, 'cpf', $palestrante->Cpf);
         $palestrante->Cargo = $this->SafeGetVal($json, 'cargo', $palestrante->Cargo);
         $palestrante->ImagemAssinatura = $this->SafeGetVal($json, 'imagemAssinatura', $palestrante->ImagemAssinatura);
         $palestrante->Validate();
         $errors = $palestrante->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Verifique erros no preenchimento do formulário', $errors);
         } else {
             $palestrante->Save();
             $this->RenderJSON($palestrante, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:joaoricardorm,项目名称:tcc,代码行数:32,代码来源:PalestranteController.php

示例14: Update

 /**
  * API Method updates an existing ModeloCertificado record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('idModeloCertificado');
         $modelocertificado = $this->Phreezer->Get('ModeloCertificado', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $modelocertificado->IdModeloCertificado = $this->SafeGetVal($json, 'idModeloCertificado', $modelocertificado->IdModeloCertificado);
         $modelocertificado->Nome = $this->SafeGetVal($json, 'nome', $modelocertificado->Nome);
         $modelocertificado->TextoParticipante = $this->SafeGetVal($json, 'textoParticipante', $modelocertificado->TextoParticipante);
         $modelocertificado->TextoPalestrante = $this->SafeGetVal($json, 'textoPalestrante', $modelocertificado->TextoPalestrante);
         $modelocertificado->ArquivoCss = $this->SafeGetVal($json, 'arquivoCss', $modelocertificado->ArquivoCss);
         $modelocertificado->Elementos = $this->SafeGetVal($json, 'elementos', $modelocertificado->Elementos);
         $modelocertificado->Validate();
         $errors = $modelocertificado->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Verifique erros no preenchimento do formulário', $errors);
         } else {
             $modelocertificado->Save();
             $this->RenderJSON($modelocertificado, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:joaoricardorm,项目名称:tcc,代码行数:32,代码来源:ModeloCertificadoController.php

示例15: Update

 /**
  * API Method updates an existing Endereco record and render response as JSON
  */
 public function Update()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $pk = $this->GetRouter()->GetUrlParam('id');
         $endereco = $this->Phreezer->Get('Endereco', $pk);
         // TODO: any fields that should not be updated by the user should be commented out
         // this is a primary key.  uncomment if updating is allowed
         // $endereco->Id = $this->SafeGetVal($json, 'id', $endereco->Id);
         $endereco->Logradouro = $this->SafeGetVal($json, 'logradouro', $endereco->Logradouro);
         $endereco->Numero = $this->SafeGetVal($json, 'numero', $endereco->Numero);
         $endereco->Complemento = $this->SafeGetVal($json, 'complemento', $endereco->Complemento);
         $endereco->Cidade = $this->SafeGetVal($json, 'cidade', $endereco->Cidade);
         $endereco->Uf = $this->SafeGetVal($json, 'uf', $endereco->Uf);
         $endereco->Cep = $this->SafeGetVal($json, 'cep', $endereco->Cep);
         $endereco->Cliente = $this->SafeGetVal($json, 'cliente', $endereco->Cliente);
         $endereco->Validate();
         $errors = $endereco->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Please check the form for errors', $errors);
         } else {
             $endereco->Save();
             $this->RenderJSON($endereco, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:ronyelias,项目名称:pizzaria,代码行数:34,代码来源:EnderecoController.php


注:本文中的RequestUtil::GetBody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。