@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | |
8 | 8 | class ConexionBaseDeDatos |
9 | 9 | { |
10 | - private $_pdo; |
|
10 | + private $_pdo; |
|
11 | 11 | |
12 | - public function __construct |
|
13 | - ( |
|
14 | - HostBaseDeDatos $HostBaseDeDatos, |
|
15 | - BaseDeDatos $BaseDeDatos, |
|
16 | - UsuarioBaseDeDatos $UsuarioBaseDeDatos, |
|
17 | - ContraseñaBaseDeDatos $ContraseñaBaseDeDatos |
|
18 | - ) |
|
19 | - { |
|
20 | - try |
|
12 | + public function __construct |
|
13 | + ( |
|
14 | + HostBaseDeDatos $HostBaseDeDatos, |
|
15 | + BaseDeDatos $BaseDeDatos, |
|
16 | + UsuarioBaseDeDatos $UsuarioBaseDeDatos, |
|
17 | + ContraseñaBaseDeDatos $ContraseñaBaseDeDatos |
|
18 | + ) |
|
19 | + { |
|
20 | + try |
|
21 | 21 | { |
22 | 22 | $this->_pdo = new PDO('mysql:host='.$HostBaseDeDatos->hostBaseDeDatos().';dbname='.$BaseDeDatos->baseDeDatos().';chartset=utf8mb4',$UsuarioBaseDeDatos->usuarioBaseDeDatos(),$ContraseñaBaseDeDatos->contraseñaBaseDeDatos()); |
23 | 23 | $this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | { |
27 | 27 | throw new ConexionABaseDeDatosException("Error al conectar con base de datos"); |
28 | 28 | } |
29 | - } |
|
29 | + } |
|
30 | 30 | |
31 | - public function conectar(): PDO |
|
32 | - { |
|
33 | - return $this->_pdo; |
|
34 | - } |
|
31 | + public function conectar(): PDO |
|
32 | + { |
|
33 | + return $this->_pdo; |
|
34 | + } |
|
35 | 35 | } |
36 | 36 | \ No newline at end of file |
@@ -5,25 +5,25 @@ |
||
5 | 5 | |
6 | 6 | class HostBaseDeDatos |
7 | 7 | { |
8 | - private $_hostbaseDeDatos; |
|
8 | + private $_hostbaseDeDatos; |
|
9 | 9 | |
10 | - public function __construct(string $nombreHostBaseDeDatos) |
|
11 | - { |
|
12 | - $this->_hostbaseDeDatos = $this->setHostBaseDeDatos($nombreHostBaseDeDatos); |
|
13 | - } |
|
10 | + public function __construct(string $nombreHostBaseDeDatos) |
|
11 | + { |
|
12 | + $this->_hostbaseDeDatos = $this->setHostBaseDeDatos($nombreHostBaseDeDatos); |
|
13 | + } |
|
14 | 14 | |
15 | - public function hostbaseDeDatos(): string |
|
16 | - { |
|
17 | - return $this->_hostbaseDeDatos; |
|
18 | - } |
|
15 | + public function hostbaseDeDatos(): string |
|
16 | + { |
|
17 | + return $this->_hostbaseDeDatos; |
|
18 | + } |
|
19 | 19 | |
20 | - private function setHostBaseDeDatos(string $nombreHostBaseDeDatos): string |
|
21 | - { |
|
22 | - if(empty($nombreHostBaseDeDatos)) |
|
23 | - { |
|
24 | - throw new Exception("El nombre del host de la base de datos no puede estar vacio"); |
|
25 | - } |
|
20 | + private function setHostBaseDeDatos(string $nombreHostBaseDeDatos): string |
|
21 | + { |
|
22 | + if(empty($nombreHostBaseDeDatos)) |
|
23 | + { |
|
24 | + throw new Exception("El nombre del host de la base de datos no puede estar vacio"); |
|
25 | + } |
|
26 | 26 | |
27 | - return $nombreHostBaseDeDatos; |
|
28 | - } |
|
27 | + return $nombreHostBaseDeDatos; |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -5,25 +5,25 @@ |
||
5 | 5 | |
6 | 6 | class BaseDeDatos |
7 | 7 | { |
8 | - private $_baseDeDatos; |
|
8 | + private $_baseDeDatos; |
|
9 | 9 | |
10 | - public function __construct(string $nombreBaseDeDatos) |
|
11 | - { |
|
12 | - $this->_baseDeDatos = $this->setBaseDeDatos($nombreBaseDeDatos); |
|
13 | - } |
|
10 | + public function __construct(string $nombreBaseDeDatos) |
|
11 | + { |
|
12 | + $this->_baseDeDatos = $this->setBaseDeDatos($nombreBaseDeDatos); |
|
13 | + } |
|
14 | 14 | |
15 | - public function baseDeDatos(): string |
|
16 | - { |
|
17 | - return $this->_baseDeDatos; |
|
18 | - } |
|
15 | + public function baseDeDatos(): string |
|
16 | + { |
|
17 | + return $this->_baseDeDatos; |
|
18 | + } |
|
19 | 19 | |
20 | - private function setBaseDeDatos(string $nombreBaseDeDatos): string |
|
21 | - { |
|
22 | - if(empty($nombreBaseDeDatos)) |
|
23 | - { |
|
24 | - throw new Exception("El nombre de la base de datos no puede estar vacio"); |
|
25 | - } |
|
20 | + private function setBaseDeDatos(string $nombreBaseDeDatos): string |
|
21 | + { |
|
22 | + if(empty($nombreBaseDeDatos)) |
|
23 | + { |
|
24 | + throw new Exception("El nombre de la base de datos no puede estar vacio"); |
|
25 | + } |
|
26 | 26 | |
27 | - return $nombreBaseDeDatos; |
|
28 | - } |
|
27 | + return $nombreBaseDeDatos; |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -15,28 +15,28 @@ |
||
15 | 15 | |
16 | 16 | class SelectWhere implements FactoryClassInterface |
17 | 17 | { |
18 | - public function crear(array $array): object |
|
19 | - { |
|
20 | - $conexion = new CrearConexionBaseDeDatos; |
|
21 | - $conexion = $conexion->crear([]); |
|
18 | + public function crear(array $array): object |
|
19 | + { |
|
20 | + $conexion = new CrearConexionBaseDeDatos; |
|
21 | + $conexion = $conexion->crear([]); |
|
22 | 22 | |
23 | - return new ConsultaSelectWhere( |
|
24 | - new EjecutarConsultaConDatos( |
|
25 | - $conexion |
|
26 | - ), |
|
27 | - new SentenciaSelectWhere( |
|
28 | - new CamposYTabla( |
|
29 | - new Campos($array['campos']), |
|
30 | - new Tabla($array['tabla']) |
|
31 | - ), |
|
32 | - new Como( |
|
33 | - new Where( |
|
34 | - new ValidadorDeParametrosWhere( |
|
35 | - $array['where'] |
|
36 | - ) |
|
37 | - ) |
|
38 | - ) |
|
39 | - ) |
|
40 | - ); |
|
41 | - } |
|
23 | + return new ConsultaSelectWhere( |
|
24 | + new EjecutarConsultaConDatos( |
|
25 | + $conexion |
|
26 | + ), |
|
27 | + new SentenciaSelectWhere( |
|
28 | + new CamposYTabla( |
|
29 | + new Campos($array['campos']), |
|
30 | + new Tabla($array['tabla']) |
|
31 | + ), |
|
32 | + new Como( |
|
33 | + new Where( |
|
34 | + new ValidadorDeParametrosWhere( |
|
35 | + $array['where'] |
|
36 | + ) |
|
37 | + ) |
|
38 | + ) |
|
39 | + ) |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -15,28 +15,28 @@ |
||
15 | 15 | |
16 | 16 | class SelectWhereOr implements FactoryClassInterface |
17 | 17 | { |
18 | - public function crear(array $array): object |
|
19 | - { |
|
20 | - $conexion = new CrearConexionBaseDeDatos; |
|
21 | - $conexion = $conexion->crear([]); |
|
18 | + public function crear(array $array): object |
|
19 | + { |
|
20 | + $conexion = new CrearConexionBaseDeDatos; |
|
21 | + $conexion = $conexion->crear([]); |
|
22 | 22 | |
23 | - return new ConsultaSelectWhere( |
|
24 | - new EjecutarConsultaConDatos( |
|
25 | - $conexion |
|
26 | - ), |
|
27 | - new SentenciaSelectWhere( |
|
28 | - new CamposYTabla( |
|
29 | - new Campos($array['campos']), |
|
30 | - new Tabla($array['tabla']) |
|
31 | - ), |
|
32 | - new Como( |
|
33 | - new WhereOr( |
|
34 | - new ValidadorDeParametrosWhereAndOthers( |
|
35 | - $array['where'] |
|
36 | - ) |
|
37 | - ) |
|
38 | - ) |
|
39 | - ) |
|
40 | - ); |
|
41 | - } |
|
23 | + return new ConsultaSelectWhere( |
|
24 | + new EjecutarConsultaConDatos( |
|
25 | + $conexion |
|
26 | + ), |
|
27 | + new SentenciaSelectWhere( |
|
28 | + new CamposYTabla( |
|
29 | + new Campos($array['campos']), |
|
30 | + new Tabla($array['tabla']) |
|
31 | + ), |
|
32 | + new Como( |
|
33 | + new WhereOr( |
|
34 | + new ValidadorDeParametrosWhereAndOthers( |
|
35 | + $array['where'] |
|
36 | + ) |
|
37 | + ) |
|
38 | + ) |
|
39 | + ) |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -15,28 +15,28 @@ |
||
15 | 15 | |
16 | 16 | class SelectWhereBetween implements FactoryClassInterface |
17 | 17 | { |
18 | - public function crear(array $array): object |
|
19 | - { |
|
20 | - $conexion = new CrearConexionBaseDeDatos; |
|
21 | - $conexion = $conexion->crear([]); |
|
18 | + public function crear(array $array): object |
|
19 | + { |
|
20 | + $conexion = new CrearConexionBaseDeDatos; |
|
21 | + $conexion = $conexion->crear([]); |
|
22 | 22 | |
23 | - return new ConsultaSelectWhere( |
|
24 | - new EjecutarConsultaConDatos( |
|
25 | - $conexion |
|
26 | - ), |
|
27 | - new SentenciaSelectWhere( |
|
28 | - new CamposYTabla( |
|
29 | - new Campos($array['campos']), |
|
30 | - new Tabla($array['tabla']) |
|
31 | - ), |
|
32 | - new Como( |
|
33 | - new WhereBetween( |
|
34 | - new ValidadorDeParametrosWhereBetween( |
|
35 | - $array['where'] |
|
36 | - ) |
|
37 | - ) |
|
38 | - ) |
|
39 | - ) |
|
40 | - ); |
|
41 | - } |
|
23 | + return new ConsultaSelectWhere( |
|
24 | + new EjecutarConsultaConDatos( |
|
25 | + $conexion |
|
26 | + ), |
|
27 | + new SentenciaSelectWhere( |
|
28 | + new CamposYTabla( |
|
29 | + new Campos($array['campos']), |
|
30 | + new Tabla($array['tabla']) |
|
31 | + ), |
|
32 | + new Como( |
|
33 | + new WhereBetween( |
|
34 | + new ValidadorDeParametrosWhereBetween( |
|
35 | + $array['where'] |
|
36 | + ) |
|
37 | + ) |
|
38 | + ) |
|
39 | + ) |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -15,28 +15,28 @@ |
||
15 | 15 | |
16 | 16 | class SelectWhereNotBetween implements FactoryClassInterface |
17 | 17 | { |
18 | - public function crear(array $array): object |
|
19 | - { |
|
20 | - $conexion = new CrearConexionBaseDeDatos; |
|
21 | - $conexion = $conexion->crear([]); |
|
18 | + public function crear(array $array): object |
|
19 | + { |
|
20 | + $conexion = new CrearConexionBaseDeDatos; |
|
21 | + $conexion = $conexion->crear([]); |
|
22 | 22 | |
23 | - return new ConsultaSelectWhere( |
|
24 | - new EjecutarConsultaConDatos( |
|
25 | - $conexion |
|
26 | - ), |
|
27 | - new SentenciaSelectWhere( |
|
28 | - new CamposYTabla( |
|
29 | - new Campos($array['campos']), |
|
30 | - new Tabla($array['tabla']) |
|
31 | - ), |
|
32 | - new Como( |
|
33 | - new WhereNotBetween( |
|
34 | - new ValidadorDeParametrosWhereBetween( |
|
35 | - $array['where'] |
|
36 | - ) |
|
37 | - ) |
|
38 | - ) |
|
39 | - ) |
|
40 | - ); |
|
41 | - } |
|
23 | + return new ConsultaSelectWhere( |
|
24 | + new EjecutarConsultaConDatos( |
|
25 | + $conexion |
|
26 | + ), |
|
27 | + new SentenciaSelectWhere( |
|
28 | + new CamposYTabla( |
|
29 | + new Campos($array['campos']), |
|
30 | + new Tabla($array['tabla']) |
|
31 | + ), |
|
32 | + new Como( |
|
33 | + new WhereNotBetween( |
|
34 | + new ValidadorDeParametrosWhereBetween( |
|
35 | + $array['where'] |
|
36 | + ) |
|
37 | + ) |
|
38 | + ) |
|
39 | + ) |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -12,21 +12,21 @@ |
||
12 | 12 | |
13 | 13 | class Select implements FactoryClassInterface |
14 | 14 | { |
15 | - public function crear(array $array): object |
|
16 | - { |
|
17 | - $conexion = new CrearConexionBaseDeDatos; |
|
18 | - $conexion = $conexion->crear([]); |
|
15 | + public function crear(array $array): object |
|
16 | + { |
|
17 | + $conexion = new CrearConexionBaseDeDatos; |
|
18 | + $conexion = $conexion->crear([]); |
|
19 | 19 | |
20 | - return new ConsultaSelect( |
|
21 | - new EjecutarConsultaSinDatos( |
|
22 | - $conexion |
|
23 | - ), |
|
24 | - new SentenciaSelect( |
|
25 | - new CamposYTabla( |
|
26 | - new Campos($array['campos']), |
|
27 | - new Tabla($array['tabla']) |
|
28 | - ) |
|
29 | - ) |
|
30 | - ); |
|
31 | - } |
|
20 | + return new ConsultaSelect( |
|
21 | + new EjecutarConsultaSinDatos( |
|
22 | + $conexion |
|
23 | + ), |
|
24 | + new SentenciaSelect( |
|
25 | + new CamposYTabla( |
|
26 | + new Campos($array['campos']), |
|
27 | + new Tabla($array['tabla']) |
|
28 | + ) |
|
29 | + ) |
|
30 | + ); |
|
31 | + } |
|
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -15,28 +15,28 @@ |
||
15 | 15 | |
16 | 16 | class SelectWhereAnd implements FactoryClassInterface |
17 | 17 | { |
18 | - public function crear(array $array): object |
|
19 | - { |
|
20 | - $conexion = new CrearConexionBaseDeDatos; |
|
21 | - $conexion = $conexion->crear([]); |
|
18 | + public function crear(array $array): object |
|
19 | + { |
|
20 | + $conexion = new CrearConexionBaseDeDatos; |
|
21 | + $conexion = $conexion->crear([]); |
|
22 | 22 | |
23 | - return new ConsultaSelectWhere( |
|
24 | - new EjecutarConsultaConDatos( |
|
25 | - $conexion |
|
26 | - ), |
|
27 | - new SentenciaSelectWhere( |
|
28 | - new CamposYTabla( |
|
29 | - new Campos($array['campos']), |
|
30 | - new Tabla($array['tabla']) |
|
31 | - ), |
|
32 | - new Como( |
|
33 | - new WhereAnd( |
|
34 | - new ValidadorDeParametrosWhereAndOthers( |
|
35 | - $array['where'] |
|
36 | - ) |
|
37 | - ) |
|
38 | - ) |
|
39 | - ) |
|
40 | - ); |
|
41 | - } |
|
23 | + return new ConsultaSelectWhere( |
|
24 | + new EjecutarConsultaConDatos( |
|
25 | + $conexion |
|
26 | + ), |
|
27 | + new SentenciaSelectWhere( |
|
28 | + new CamposYTabla( |
|
29 | + new Campos($array['campos']), |
|
30 | + new Tabla($array['tabla']) |
|
31 | + ), |
|
32 | + new Como( |
|
33 | + new WhereAnd( |
|
34 | + new ValidadorDeParametrosWhereAndOthers( |
|
35 | + $array['where'] |
|
36 | + ) |
|
37 | + ) |
|
38 | + ) |
|
39 | + ) |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | \ No newline at end of file |