Supprimer 'models/sourceModel.php'

pull/17/head
Kevin MONDEJAR 6 months ago
parent ca49ecd74e
commit abd5c8c380

@ -1,61 +0,0 @@
<?php
require_once "sourceEntity.php";
require_once "sourceGateway.php";
class SourceModel
{
private sourceGateway $gateway;
public function __construct(SourceGateway $gateway)
{
$this -> gateway = $gateway;
}
public function createSource(int $id_source, string $title, string $date) : bool
{
$q = new SourceEntity($id_source , $title, $date);
return $this -> gateway -> create($q);
}
public function getSourceById(int $id_source) : ?SourceEntity
{
return $this -> gateway -> findById($id_source);
}
public function getSourceByTitle(string $title) : ?SourceEntity
{
return $this -> gateway -> findByTitle($title);
}
public function getSourceByDate(string $date) : ?SourceEntity
{
return $this -> gateway -> findByDate($date);
}
public function getSources() : array
{
return $this -> gateway -> findAll();
}
public function deleteSource(int $id_source) : bool
{
return $this -> gateway -> delete($id_source);
}
public function updateSource(int $id_source, string $title, string $date) : bool
{
$q = $this -> gateway -> findById($id_source);
if ($q){
$q -> setTitle($title);
$q -> setDate($date);
return $this -> gateway -> update($q);
}
return false;
}
}
Loading…
Cancel
Save