/** * Modificar * * @param ClienteAgenciaCargaData $ClienteAgenciaCargaData * @return array Retorna un Array $key el cual contiene el id */ public function eliminar(ClienteAgenciaCargaData $ClienteAgenciaCargaData) { $key = array('cliente_id' => $ClienteAgenciaCargaData->getClienteId(), 'agencia_carga_id' => $ClienteAgenciaCargaData->getAgenciaCargaId()); $this->getEntityManager()->getConnection()->delete($this->table_name, $key); return true; }
public function eliminarAction() { try { $SesionUsuarioPlugin = $this->SesionUsuarioPlugin(); $usuario_id = $SesionUsuarioPlugin->getUsuarioId(); $EntityManagerPlugin = $this->EntityManagerPlugin(); $ClienteAgenciaCargaBO = new ClienteAgenciaCargaBO(); $ClienteAgenciaCargaBO->setEntityManager($EntityManagerPlugin->getEntityManager()); $respuesta = $SesionUsuarioPlugin->isLoginAdmin(); if ($respuesta == false) { return false; } //Recibe las variables del Json $body = $this->getRequest()->getContent(); $json = json_decode($body, true); $formData = $json['formData']; $cliente_id = $formData['cliente_id']; $grid_data = $json['grid_data']; //Prepara el Buffer de datos antes de llamar al BO $ArrClienteAgenciaCargaData = array(); foreach ($grid_data as $reg) { $ClienteAgenciaCargaData = new ClienteAgenciaCargaData(); $ClienteAgenciaCargaData->setClienteId($cliente_id); $ClienteAgenciaCargaData->setAgenciaCargaId($reg['agencia_carga_id']); $ArrClienteAgenciaCargaData[] = $ClienteAgenciaCargaData; } //end foreach //Graba $result = $ClienteAgenciaCargaBO->eliminar($ArrClienteAgenciaCargaData); //Retorna la informacion resultante por JSON $response = new \stdClass(); $response->respuesta_code = 'OK'; /*$response->validacion_code = $result['validacion_code']; $response->respuesta_mensaje = $result['respuesta_mensaje']; */ $json = new JsonModel(get_object_vars($response)); return $json; //false } catch (\Exception $e) { $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e)); $response = $this->getResponse(); $response->setStatusCode(500); $response->setContent($excepcion_msg); return $response; } }