@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | public function consulta(): PDOStatement |
26 | - { |
|
27 | - $consulta = $this->_conexionBaseDeDatos->prepare($this->_query->query()); |
|
26 | + { |
|
27 | + $consulta = $this->_conexionBaseDeDatos->prepare($this->_query->query()); |
|
28 | 28 | |
29 | 29 | if(!empty($this->_query->valores())) |
30 | 30 | { |
@@ -46,5 +46,5 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | return $consulta; |
49 | - } |
|
49 | + } |
|
50 | 50 | } |
51 | 51 | \ No newline at end of file |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | private $_conexionBaseDeDatos; |
13 | 13 | private $_query; |
14 | 14 | |
15 | - public function __construct |
|
16 | - ( |
|
15 | + public function __construct( |
|
17 | 16 | ConexionBaseDeDatos $ConexionBaseDeDatos, |
18 | 17 | Query $Query |
19 | 18 | ) |
@@ -26,12 +25,12 @@ discard block |
||
26 | 25 | { |
27 | 26 | $consulta = $this->_conexionBaseDeDatos->prepare($this->_query->query()); |
28 | 27 | |
29 | - if(!empty($this->_query->valores())) |
|
28 | + if (!empty($this->_query->valores())) |
|
30 | 29 | { |
31 | - $x=1; |
|
30 | + $x = 1; |
|
32 | 31 | foreach ($this->_query->valores() as $value) |
33 | 32 | { |
34 | - $consulta->bindValue($x,$value); |
|
33 | + $consulta->bindValue($x, $value); |
|
35 | 34 | $x++; |
36 | 35 | } |
37 | 36 | } |
@@ -40,7 +39,7 @@ discard block |
||
40 | 39 | { |
41 | 40 | $consulta->execute(); |
42 | 41 | } |
43 | - catch(PDOException $e) |
|
42 | + catch (PDOException $e) |
|
44 | 43 | { |
45 | 44 | throw new ConsultaException("Error al procesar la consulta"); |
46 | 45 | } |
@@ -39,8 +39,7 @@ |
||
39 | 39 | try |
40 | 40 | { |
41 | 41 | $consulta->execute(); |
42 | - } |
|
43 | - catch(PDOException $e) |
|
42 | + } catch(PDOException $e) |
|
44 | 43 | { |
45 | 44 | throw new ConsultaException("Error al procesar la consulta"); |
46 | 45 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | public function crear(array $array): Consulta |
23 | 23 | { |
24 | - $donde = new Donde( |
|
24 | + $donde = new Donde( |
|
25 | 25 | new MasDonde($this->masDonde($array)), |
26 | 26 | $this->donde($array) |
27 | 27 | ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | private function campos(array $array): array |
49 | 49 | { |
50 | - if(isset($array['campos'])) |
|
50 | + if (isset($array['campos'])) |
|
51 | 51 | { |
52 | 52 | return $array['campos']; |
53 | 53 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | private function donde($array): array |
59 | 59 | { |
60 | - if(isset($array['donde'])) |
|
60 | + if (isset($array['donde'])) |
|
61 | 61 | { |
62 | 62 | return $array['donde']; |
63 | 63 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | private function masDonde($array): array |
69 | 69 | { |
70 | - if( is_array($this->donde($array)) && isset($array['masDonde']) ) |
|
70 | + if (is_array($this->donde($array)) && isset($array['masDonde'])) |
|
71 | 71 | { |
72 | 72 | return $array['masDonde']; |
73 | 73 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | private function entre(array $array): array |
79 | 79 | { |
80 | - if(isset($array['entre'])) |
|
80 | + if (isset($array['entre'])) |
|
81 | 81 | { |
82 | 82 | return $array['entre']; |
83 | 83 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | private function limite(array $array) |
89 | 89 | { |
90 | - if(isset($array['limite'])) |
|
90 | + if (isset($array['limite'])) |
|
91 | 91 | { |
92 | 92 | return $array['limite']; |
93 | 93 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | private function orden(array $array) |
97 | 97 | { |
98 | - if(isset($array['orden'])) |
|
98 | + if (isset($array['orden'])) |
|
99 | 99 | { |
100 | 100 | return $array['orden']; |
101 | 101 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | declare(strict_types=1); |
8 | 8 | |
9 | -require_once __DIR__ . '/vendor/autoload.php'; |
|
9 | +require_once __DIR__.'/vendor/autoload.php'; |
|
10 | 10 | |
11 | 11 | use src\pdoDataBase\conexion\{ |
12 | 12 | BaseDeDatos, |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | $prueba = new Consulta( |
87 | 87 | $conexion, |
88 | - new Query($sql->select(),$donde->datos()) |
|
88 | + new Query($sql->select(), $donde->datos()) |
|
89 | 89 | ); |
90 | 90 | echo '<h1>Obteniendo la consulta de un select</h1>'; |
91 | 91 | var_dump( |