You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
<?php
|
|
|
|
namespace DAL;
|
|
|
|
use PDO;
|
|
|
|
class FluxGateway
|
|
{
|
|
private Connection $con;
|
|
|
|
public function __construct(Connection $con){
|
|
$this->con = $con;
|
|
}
|
|
|
|
public function addFlux($flux){
|
|
$query = 'INSERT INTO Flux VALUES (:flux);';
|
|
$this->con->executeQuery($query, array(':flux' => array($flux->getFlux(), PDO::PARAM_STR)));
|
|
}
|
|
|
|
public function removeFlux($flux){
|
|
$query = 'DELETE FROM Flux WHERE flux = :flux;';
|
|
$this->con->executeQuery($query, array(':flux' => array($flux->getFlux(), PDO::PARAM_STR)));
|
|
}
|
|
|
|
public function findAllFlux(){
|
|
$query = 'SELECT * FROM Flux;';
|
|
$this->con->executeQuery($query);
|
|
return $this->con->getResults();
|
|
}
|
|
|
|
public function findFlux(Flux $flux){
|
|
return $this->findFluxBySrc($flux->getFlux());
|
|
}
|
|
|
|
public function findFluxBySrc(string $flux){
|
|
$query = 'SELECT * FROM Flux WHERE flux = :flux;';
|
|
$this->con->executeQuery($query, array(':flux' => array($flux, PDO::PARAM_STR)));
|
|
return $this->con->getResults();
|
|
}
|
|
} |