diff --git a/fluxRSS/src/DAL/ArticleGateway.php b/fluxRSS/src/DAL/ArticleGateway.php index e08f763..a6adc1a 100755 --- a/fluxRSS/src/DAL/ArticleGateway.php +++ b/fluxRSS/src/DAL/ArticleGateway.php @@ -47,6 +47,15 @@ class ArticleGateway $this->con->executeQuery($query); } + public function removeAllArticleFromFlux(int $idFlux){ + try { + $query = 'DELETE FROM Article WHERE Provenance = :idFlux;'; + $this->con->executeQuery($query, array(':idFlux' => array($idFlux, PDO::PARAM_INT))); + }catch(\PDOException $p){ + throw new Exception("Data of flux is not delete."); + } + } + public function findArticleByFlux(int $flux){ $query = 'SELECT * FROM Article WHERE provenance = :flux;'; $this->con->executeQuery($query, array(':flux' => array($flux, PDO::PARAM_INT))); diff --git a/fluxRSS/src/DAL/FluxGateway.php b/fluxRSS/src/DAL/FluxGateway.php index bcdbcec..3675a06 100755 --- a/fluxRSS/src/DAL/FluxGateway.php +++ b/fluxRSS/src/DAL/FluxGateway.php @@ -33,6 +33,11 @@ class FluxGateway $this->con->executeQuery($query, array(':flux' => array($flux, PDO::PARAM_STR))); } + public function removeFluxById(int $id){ + $query = 'DELETE FROM Flux WHERE id = :id;'; + $this->con->executeQuery($query, array(':id' => array($id, PDO::PARAM_INT))); + } + public function findAllFlux(){ $query = 'SELECT * FROM Flux;'; $this->con->executeQuery($query); diff --git a/fluxRSS/src/model/FluxModel.php b/fluxRSS/src/model/FluxModel.php index a79eedb..5a329c3 100755 --- a/fluxRSS/src/model/FluxModel.php +++ b/fluxRSS/src/model/FluxModel.php @@ -39,6 +39,11 @@ class FluxModel $gateway->removeFlux($flux); } + public function removeFluxById(int $id){ + $gateway = new FluxGateway(new Connection('mysql:host=londres.uca.local;dbname=dbrorossetto','rorossetto','tpphp')); + $gateway->removeFluxById($id); + } + public function removeFluxBySrc(string $flux) { $gateway = new FluxGateway(new Connection('mysql:host=londres.uca.local;dbname=dbrorossetto','rorossetto','tpphp')); $gateway->removeFluxBySrc($flux); diff --git a/fluxRSS/templates/listFlux.html b/fluxRSS/templates/listFlux.html index 14d182e..b503f89 100755 --- a/fluxRSS/templates/listFlux.html +++ b/fluxRSS/templates/listFlux.html @@ -9,7 +9,7 @@
{{ value.getFlux() }}
- +