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; } }