con = $con; } public function addFlux(Flux $flux) { $query = 'INSERT INTO Flux VALUES (:flux);'; $this->con->executeQuery($query, array(':flux' => array($flux->getFlux(), PDO::PARAM_STR))); } public function getId(): int { return $this->id; } public function addFlux($flux){ try{ $query = 'INSERT INTO Flux VALUES (:flux);'; $this->con->executeQuery($query, array(':flux' => array($flux->getFlux(), PDO::PARAM_STR))); }catch (\PDOException $e){ throw new \Exception("PDO error"); } public function removeFlux(Flux $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(); } }