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.
71 lines
2.3 KiB
71 lines
2.3 KiB
<?php
|
|
|
|
namespace model;
|
|
|
|
use DAL\Connection;
|
|
use DAL\FluxGateway;
|
|
use metier\Flux;
|
|
require_once "config/config.php";
|
|
|
|
class FluxModel
|
|
{
|
|
public function FindAllFlux(){
|
|
$gateway = new FluxGateway(new Connection('mysql:host= londres.uca.local ; dbname= dbrorossetto', 'rorossetto', 'tpphp'));
|
|
$data = array();
|
|
$result = $gateway->findAllFlux();
|
|
|
|
foreach ($result as $row){
|
|
$data[] = new Flux($row['$flux']);
|
|
}
|
|
return $data;
|
|
}
|
|
|
|
public function addFlux(Flux $flux){
|
|
$gateway = new FluxGateway(new Connection('mysql:host= londres.uca.local ; dbname= dbrorossetto', 'rorossetto', 'tpphp'));
|
|
$data = $this->findFlux($flux);
|
|
if ($data == array()) {
|
|
$gateway->addFlux($flux);
|
|
}
|
|
}
|
|
|
|
public function addFluxBySrc(string $flux): Flux {
|
|
$gateway = new FluxGateway(new Connection('mysql:host= londres.uca.local ; dbname= dbrorossetto', 'rorossetto', 'tpphp'));
|
|
$newFlux = new Flux($flux);
|
|
$gateway->addFlux($newFlux);
|
|
return $newFlux;
|
|
}
|
|
|
|
public function removeFlux(Flux $flux){
|
|
$gateway = new FluxGateway(new Connection('mysql:host= londres.uca.local ; dbname= dbrorossetto', 'rorossetto', 'tpphp'));
|
|
$gateway->removeFlux($flux);
|
|
}
|
|
|
|
public function removeFluxBySrc(string $flux): Flux {
|
|
$gateway = new FluxGateway(new Connection('mysql:host= londres.uca.local ; dbname= dbrorossetto', 'rorossetto', 'tpphp'));
|
|
$newFlux = new Flux($flux);
|
|
$gateway->removeFlux($newFlux);
|
|
return $newFlux;
|
|
}
|
|
|
|
public function findFlux(Flux $flux){
|
|
$gateway = new FluxGateway(new Connection('mysql:host= londres.uca.local ; dbname= dbrorossetto', 'rorossetto', 'tpphp'));
|
|
$data = array();
|
|
$result = $gateway->findFlux($flux);
|
|
|
|
foreach ($result as $row){
|
|
$data[] = new Flux($row['$flux']);
|
|
}
|
|
return $data;
|
|
}
|
|
|
|
public function findFluxBySrc(string $flux){
|
|
$gateway = new FluxGateway(new Connection('mysql:host= londres.uca.local ; dbname= dbrorossetto', 'rorossetto', 'tpphp'));
|
|
$data = array();
|
|
$result = $gateway->findFluxBySrc($flux);
|
|
|
|
foreach ($result as $row){
|
|
$data[] = new Flux($row['$flux']);
|
|
}
|
|
return $data;
|
|
}
|
|
} |