Creando film_dao basado en los dao ya existentes
This commit is contained in:
parent
7bb31aac8e
commit
35e1cc7405
39
panel_admin/film_dao.php
Normal file
39
panel_admin/film_dao.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
require_once('../assets/php/dao.php');
|
||||
include_once('film_dto.php');
|
||||
|
||||
class Film_DAO extends DAO {
|
||||
|
||||
//Constructor:
|
||||
function __construct($bd_name){
|
||||
parent::__construct($bd_name);
|
||||
}
|
||||
|
||||
//Methods:
|
||||
|
||||
//Create a new Session.
|
||||
public function createFilm($id, $tittle, $duration, $language){
|
||||
|
||||
$sql = sprintf( "INSERT INTO film( $id, $tittle, $duration, $language)
|
||||
VALUES ( '%d', '%s', '%d', '%s')",
|
||||
$id, $tittle, $duration, $language);
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
//Returns a query to get the film's data.
|
||||
public function FilmData($id){
|
||||
$sql = sprintf( "SELECT * FROM film WHERE id = '%d'", $id );
|
||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||
|
||||
return $resul;
|
||||
}
|
||||
|
||||
//Create a new film Data Transfer Object.
|
||||
public function loadFilm($id, $tittle, $duration, $language){
|
||||
return new FilmDTO( $id, $tittle, $duration, $language);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user