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


PHP Cliente::Save方法代码示例

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


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

示例1: Create

 /**
  * API Method inserts a new Cliente record and render response as JSON
  */
 public function Create()
 {
     try {
         $json = json_decode(RequestUtil::GetBody());
         if (!$json) {
             throw new Exception('The request body does not contain valid JSON');
         }
         $cliente = new Cliente($this->Phreezer);
         // TODO: any fields that should not be inserted by the user should be commented out
         // this is an auto-increment.  uncomment if updating is allowed
         // $cliente->Id = $this->SafeGetVal($json, 'id');
         $cliente->Nome = $this->SafeGetVal($json, 'nome');
         $cliente->Telefone = $this->SafeGetVal($json, 'telefone');
         $cliente->Email = $this->SafeGetVal($json, 'email');
         $cliente->Referencia = $this->SafeGetVal($json, 'referencia');
         $cliente->Tipo = $this->SafeGetVal($json, 'tipo');
         $cliente->Docreceitafederal = $this->SafeGetVal($json, 'docreceitafederal');
         $cliente->Enderecos = $this->SafeGetVal($json, 'enderecos');
         $cliente->Validate();
         $errors = $cliente->GetValidationErrors();
         if (count($errors) > 0) {
             $this->RenderErrorJSON('Please check the form for errors', $errors);
         } else {
             $cliente->Save();
             $this->RenderJSON($cliente, $this->JSONPCallback(), true, $this->SimpleObjectParams());
         }
     } catch (Exception $ex) {
         $this->RenderExceptionJSON($ex);
     }
 }
开发者ID:ronyelias,项目名称:pizzaria,代码行数:33,代码来源:ClienteController.php

示例2:

    $cliente->email = get_filter('email');
    $cliente->endereco = get_filter('endereco');
    $cliente->complemento = get_filter('complemento');
    $cliente->bairro = get_filter('bairro');
    $cliente->cep = get_filter('cep');
    $cliente->telefone_fixo = get_filter('telefone_fixo');
    $cliente->telefone_celular = get_filter('telefone_celular');
    $cliente->responsavel = get_filter('responsavel');
    $cliente->pai = get_filter('pai');
    $cliente->telefone_pai = get_filter('telefone_pai');
    $cliente->email_pai = get_filter('email_pai');
    $cliente->mae = get_filter('mae');
    $cliente->telefone_mae = get_filter('telefone_mae');
    $cliente->email_mae = get_filter('email_mae');
    $cliente->observacao = get_filter('observacao');
    $update = $cliente->Save();
    if ($update == 1) {
        echo json_encode(['success' => true]);
    } else {
        echo json_encode(['error' => 'true']);
    }
}
//ação de deletar cliente
if ($action == 'delete') {
    $cliente->id = get_filter('id');
    $delete = $cliente->Delete();
    if ($delete == 1) {
        echo json_encode(['success' => true]);
    } else {
        echo json_encode(['error' => 'true']);
    }
开发者ID:vinigomescunha,项目名称:Sistema-Baseado-em-Partes-com-MySQL,代码行数:31,代码来源:index.php

示例3: actionDatos

 public function actionDatos()
 {
     $model = new Pedido();
     if (Yii::app()->user->getState('pedido')) {
         $model = Yii::app()->user->getState('pedido');
     }
     if (isset($_POST['Pedido'])) {
         $model->attributes = $_POST['Pedido'];
         if ($model->validate()) {
             if (!($model_cliente = Cliente::model()->findByPk($model->IdCliente))) {
                 $model_cliente = new Cliente();
                 $model_cliente->IdCliente = $model->IdCliente;
                 $model_cliente->DomicilioFacturacion = $model->DomicilioEnvio;
                 $model_cliente->CPFacturacion = $model->CPEnvio;
                 $model_cliente->PoblacionFacturacion = $model->PoblacionEnvio;
                 $model_cliente->ProvinciaFacturacion = $model->ProvinciaEnvio;
                 $model_cliente->Save();
             }
             if ($model->save()) {
                 if (Yii::app()->user->getState('carrito')) {
                     $productos = Yii::app()->user->getState('carrito');
                     foreach ($productos as $model_linea) {
                         $model_linea->IdLinea = null;
                         $model_linea->IdPedido = $model->IdPedido;
                         $model_linea->Save();
                     }
                     unset(Yii::app()->user->carrito);
                     unset(Yii::app()->user->pedido);
                     $this->redirect(array('view', 'id' => $model->IdPedido));
                 }
             }
         }
     }
     $this->render('datos', array('model' => $model));
 }
开发者ID:EPSZ-DAW2,项目名称:daw2-2014-libreria,代码行数:35,代码来源:PedidoController.php


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