Skip to content
This repository has been archived by the owner on Mar 11, 2023. It is now read-only.

Commit

Permalink
Correcciones de sintaxis
Browse files Browse the repository at this point in the history
  • Loading branch information
raupulus committed Jun 24, 2018
1 parent b044f90 commit 45dbb83
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
13 changes: 7 additions & 6 deletions components/DbConnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ class DbConnect
{
private $cnx;

public function __construct($conf) {
public function __construct($conf)
{
$this->config = $conf;
}

/**
* Establishing connection with database
* @return PDO Handler for PDO is return.
*/
public function connect() {
public function connect()
{
try {
$this->cnx = new PDO(
$this->config['dsn'].';charset='.$this->config['dsn'],
Expand All @@ -34,15 +36,14 @@ public function connect() {
$this->cnx->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);

return $this->cnx;
} catch(PDOException $ex) {
} catch (PDOException $ex) {
// if the environment is development, show error details, otherwise show generic message
if ((defined('ENVIRONMENT')) && (ENVIRONMENT == 'development')) {
if ((defined('ENVIRONMENT')) && (ENVIRONMENT === 'development')) {
echo 'An error occured connecting to the database! Details: ' . $ex->getMessage();
} else {
echo 'An error occured connecting to the database!';
}
exit;
die();
}
}
}
?>
1 change: 0 additions & 1 deletion components/DbHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@ public function all($array)
// Lógica para delete
}
}

1 change: 0 additions & 1 deletion helpers/EchoResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,4 @@ public static function response($response, $status_code = 200)
422 Unprocessable Entity
500 Internal Server Error
*/
?>

1 change: 0 additions & 1 deletion v1/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use app\components\DbConnect;
use app\components\DbHandler;


/* Usando GET para consultar un usuario */
$app->get('/user/{id}', function ($request, $response, $args) {
$user_id = (int)$args['id'];
Expand Down

0 comments on commit 45dbb83

Please sign in to comment.