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