Supprimer 'models/characterModel.php'

pull/17/head
Kevin MONDEJAR 6 months ago
parent 83ecf5b0db
commit dbfc6bcbd1

@ -1,54 +0,0 @@
<?php
require_once "characterEntity.php";
require_once "characterGateway.php";
class CharacterModel
{
private characterGateway $gateway;
public function __construct(characterGateway $gateway)
{
$this -> gateway = $gateway;
}
public function createCharacter(int $id_character, string $name , string $img_path) : bool
{
$q = new CharacterEntity($id_character, $name, $img_path);
return $this -> gateway -> create($q);
}
public function getCharacterById(int $id_character) : ?CharacterEntity
{
return $this -> gateway -> findById($id_character);
}
public function getCharacterByName(string $name) : ?CharacterEntity
{
return $this -> gateway -> findByName($name);
}
public function getAllCharacters() : array
{
return $this -> gateway -> findAll();
}
public function deleteCharacter(int $id_character) : bool
{
return $this -> gateway -> delete($id_character);
}
public function updateCharacter(int $id_character, string $name, string $img_path) : bool
{
$q = $this -> gateway -> findById($id_character);
if($q){
$q -> setName($name);
$q -> setImgPath($img_path);
return $this -> gateway -> update($q);
}
return false;
}
}
Loading…
Cancel
Save