本文整理汇总了PHP中Empresa::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Empresa::save方法的具体用法?PHP Empresa::save怎么用?PHP Empresa::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Empresa
的用法示例。
在下文中一共展示了Empresa::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Empresa();
$model->nombre = $_POST['nombreEmpresa'];
$model->ruc = $_POST['ruc'];
$model->descripcion = $_POST['descripcionEmpresa'];
$model->save();
$this->redirect(array('default/index'));
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$data = Input::all();
$empresa = new Empresa();
$empresa->nombre = $data['nombre'];
$empresa->ruc = $data['ruc'];
$empresa->telefono = $data['telefono'];
$empresa->descripcion = $data['descripcion'];
$empresa->save();
return Redirect::route('datos.empresas.index');
}
示例3: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aEmpresa !== null) {
if ($this->aEmpresa->isModified() || $this->aEmpresa->isNew()) {
$affectedRows += $this->aEmpresa->save($con);
}
$this->setEmpresa($this->aEmpresa);
}
if ($this->aItem !== null) {
if ($this->aItem->isModified() || $this->aItem->isNew()) {
$affectedRows += $this->aItem->save($con);
}
$this->setItem($this->aItem);
}
if ($this->isNew()) {
$this->modifiedColumns[] = DocumentoPeer::ID_DOCUMENTO;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = DocumentoPeer::doInsert($this, $con);
$affectedRows += 1;
// we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setIdDocumento($pk);
//[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows += DocumentoPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collHistoricoDocumentos !== null) {
foreach ($this->collHistoricoDocumentos as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例4: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Empresa();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Empresa'])) {
$model->attributes = $_POST['Empresa'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->EMP_CORREL));
}
}
$this->render('create', array('model' => $model));
}
示例5: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aEmpresa !== null) {
if ($this->aEmpresa->isModified() || $this->aEmpresa->isNew()) {
$affectedRows += $this->aEmpresa->save($con);
}
$this->setEmpresa($this->aEmpresa);
}
if ($this->aDocumento !== null) {
if ($this->aDocumento->isModified() || $this->aDocumento->isNew()) {
$affectedRows += $this->aDocumento->save($con);
}
$this->setDocumento($this->aDocumento);
}
if ($this->aUsuario !== null) {
if ($this->aUsuario->isModified() || $this->aUsuario->isNew()) {
$affectedRows += $this->aUsuario->save($con);
}
$this->setUsuario($this->aUsuario);
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = HistoricoDocumentoPeer::doInsert($this, $con);
$affectedRows += 1;
// we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setNew(false);
} else {
$affectedRows += HistoricoDocumentoPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例6: store
public function store()
{
$rules = array('nombre_representante' => 'required', 'razon_social' => 'required', 'email' => 'required', 'sector' => 'required');
$validator = \Validator::make(Input::all(), $rules);
if ($validator->passes()) {
$empresa = new \Empresa();
$empresa->nombre_representante = Input::get('nombre_representante');
$empresa->razon_social = Input::get('razon_social');
$empresa->email = Input::get('email');
$empresa->telefono = Input::get('telefono');
$empresa->sector = Input::get('sector');
$empresa->intereses = Input::get('intereses');
$empresa->save();
return Response::json(['success' => 1], 200);
} else {
return Response::json($validator->messages(), 200);
}
}
示例7: postEmpresas
function postEmpresas(Request $request, Response $response)
{
$response = $response->withHeader('Content-type', 'application/json');
$data = json_decode($request->getBody(), true);
try {
$empresa = new Empresa();
$empresa->email = $data['email'];
$empresa->nombre = $data['nombre'];
$empresa->pass = $data['pass'];
$empresa->save();
$respuesta = json_encode(array('msg' => "Guardado correctamente", "std" => 1, "obj" => $data));
$response = $response->withStatus(200);
} catch (Exception $err) {
$respuesta = json_encode(array('msg' => "La empresa ya existe", "std" => 0, "err" => $err->getMessage()));
$response = $response->withStatus(404);
}
$response->getBody()->write($respuesta);
return $response;
}
示例8: post
function post(Request $request, Response $response)
{
$response = $response->withHeader('Content-type', 'application/json');
$data = json_decode($request->getBody(), true);
try {
$empresa = new Empresa();
$empresa->nit = $data['nit'];
$empresa->razonSocial = $data['razonSocial'];
$empresa->email = $data['email'];
$empresa->telefono = $data['telefono'];
$empresa->contacto = $data['contacto'];
$empresa->promedio = '0';
$empresa->pass = sha1($data['pass']);
$empresa->estado = "INACTIVO";
$empresa->save();
$administrador = new Empleado();
$administrador->nombres = $data['nombres'];
$administrador->apellidos = $data['apellidos'];
$administrador->identificacion = $data['identificacion'];
$administrador->pass = sha1($data['pass']);
$administrador->estado = "INACTIVO";
$administrador->telefono = $data['telefonoadmin'];
$administrador->idperfil = '3';
$administrador->email = $data['emailadmin'];
$administrador->idEmpresa = $empresa->id;
$administrador->save();
for ($i = 0; $i < count($data['sectores']); $i++) {
$sector = new SectorEmpresa();
$sector->idSector = $data['sectores'][$i]['id'];
$sector->idEmpresa = $empresa->id;
$sector->save();
}
$respuesta = json_encode(array('msg' => "Guardado correctamente", "std" => 1));
$response = $response->withStatus(200);
} catch (Exception $err) {
$respuesta = json_encode(array('msg' => "error", "std" => 0, "err" => $err->getMessage()));
$response = $response->withStatus(404);
}
$response->getBody()->write($respuesta);
return $response;
}
示例9: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Empresa();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Empresa'])) {
$model->attributes = $_POST['Empresa'];
if ($model->save()) {
date_default_timezone_set('America/Caracas');
}
$auditoria = new Auditoria();
$auditoria->id_user = Yii::app()->user->getId();
$auditoria->accion = 2;
$auditoria->modelo = $this->modelo;
$auditoria->id_registro = $model->id;
$auditoria->fecha = date("Y-m-d h:i:s");
$auditoria->save(false);
$this->redirect(array('view', 'id' => $model->id));
}
$this->render('create', array('model' => $model));
}
示例10: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$form = Input::all();
$empresa = new Empresa();
$empresa->descripcion = Input::get('nombreEmpresa');
$empresa->nit = Input::get('nit');
$empresa->email = Input::get('email');
$empresa->password = Input::get('clave');
if ($empresa->validate($form)) {
$empresa->save();
$view = View::make('page.registro')->with('notificacionS', 'Registro Exitoso');
if (Request::ajax()) {
$section = $view->renderSections();
return Response::json($section['content']);
} else {
return $view;
}
} else {
$view = View::make('page.registro')->with(array('errors' => $empresa->showErrors(), 'notificacionS' => 'Error!'));
if (Request::ajax()) {
$section = $view->renderSections();
return Response::json($section['content']);
} else {
return $view;
}
}
//if($empresa->validate($form)){
// $empresa->save();
// return Response::json(array('notificacionSuccess'=>'Registro Exitoso'));
//}else{
// $sections['content']->with(array('errors'=>$empresa->showErrors(),'notificacionFail'=>'Error'));
// return Response::json($this->sections);
//return Response::json($section['content']);
//}
//$direccion=$empresa->direccion()->save($direccion);
//$telefono=$direccion->telefono()->save($telefono);
}
示例11: add_empresa
public function add_empresa()
{
$inputs = Input::all();
$rules = array('empresa_rif' => 'required|max:50|unique:empresa,empresa_rif', 'empresa_nombre' => 'required|max:100', 'empresa_siglas' => 'required|max:10');
$validator = Validator::make($inputs, $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator);
} else {
$empresa = new Empresa();
$empresa->empresa_rif = Input::get('empresa_rif');
$empresa->empresa_nombre = Input::get('empresa_nombre');
$empresa->empresa_siglas = Input::get('empresa_siglas');
$empresa->empresa_tipo_institucion = Input::get('empresa_tipo_institucion');
$empresa->fk_lugar = Input::get('fk_lugar');
if ($empresa->save()) {
Session::flash('message', 'Guardado Correctamente');
Session::flash('class', 'success');
} else {
Session::flash('message', 'Ha ocurrido un error, intentelo nuevamente');
Session::flash('class', 'danger');
}
return Redirect::to('empresa');
}
}
示例12: registrarNovo
public function registrarNovo()
{
$emp = new Empresa();
$emp->nomeFantasia = $_REQUEST['empresa'];
$emp->cnpj = $this->limpaDigitos($_REQUEST['cnpj']);
$idEmpresa = $emp->save();
$this->nome = $_REQUEST['nome'];
$this->ativo = 0;
$this->senha = "";
$this->perfil = new Perfil(1);
$this->empresa = $emp;
$this->email = $_REQUEST['email'];
$this->foto = "user.png";
$this->dataCadastro = date("Y-m-d");
$this->save();
$email = new Email();
if ($email->enviarEmailNovoUsuario($this->nome, $this->email, $this->id)) {
Message::setMensagem(14);
return true;
} else {
Message::setMensagem(31);
return false;
}
}
示例13: postCrear
/**
* Store a newly created resource in storage.
* POST /empresa/crear
*
* @return Response
*/
public function postCrear()
{
//si la peticion es ajax
if (Request::ajax()) {
$regex = 'regex:/^([a-zA-Z .,ñÑÁÉÍÓÚáéíóú]{2,60})$/i';
$required = 'required';
$reglas = array('nombre' => $required . '|' . $regex);
$mensaje = array('required' => ':attribute Es requerido', 'regex' => ':attribute Solo debe ser Texto');
$validator = Validator::make(Input::all(), $reglas, $mensaje);
if ($validator->fails()) {
return Response::json(array('rst' => 2, 'msj' => $validator->messages()));
}
$empresas = new Empresa();
$empresas['nombre'] = Input::get('nombre');
$empresas['es_ec'] = Input::get('es_ec');
$empresas['estado'] = Input::get('estado');
$empresas->save();
return Response::json(array('rst' => 1, 'msj' => 'Registro realizado correctamente'));
}
}
示例14: actionCreate
/**
Empresa
*/
public function actionCreate()
{
$model = new Empresa();
if (isset($_POST['Empresa'])) {
$model->attributes = $_POST['Empresa'];
if ($model->save()) {
$this->redirect(array('admin'));
}
}
$this->render('create', array('model' => $model));
}
示例15: postRegistro
public function postRegistro()
{
include_once public_path() . '/securimage/securimage.php';
$securimage = new Securimage();
$captcha_sesion = strtoupper($securimage->getCode());
include app_path() . "/include/cifrado.php";
$empresa = new Empresa();
$data = Input::all();
$data['captcha_sesion'] = $captcha_sesion;
$data['captcha_code'] = strtoupper($data['captcha_code']);
if (!$empresa->isValid($data)) {
return Redirect::action('Empresa_EmpresaController@getRegistro')->withInput(Input::except('password'))->withErrors($empresa->errors)->with('id_municipio', $data['municipio']);
}
foreach ($data as $key => $value) {
if ($key != 'password' && $key != 'email') {
$data[$key] = strtoupper($value);
}
}
$data['password'] = encriptar($data['password']);
$data['cod_verif'] = rand(111111, 999999);
$empresa->fill($data);
$empresa->save();
return Redirect::action('Empresa_EmpresaController@getVerificar', array($empresa->id))->with('message_ok', 'Registro Completado.
Por favor, inserte el código de verificación que le hemos enviado a su correo electrónico. Gracias');
}