gw = $gw; } public function createComment(int $id_comment, string $comment, string $date): bool { $c = new CommentaryEntity($id_comment, $comment, $date); return $this->gw->create($c); } public function getComment(int $id_comment): ?commentaryEntity { return $this -> gw -> findById($id_comment); } public function getComments(): array { return $this -> gw -> findAll(); } public function deleteComment(int $id_comment): bool { return $this -> gw -> delete($id_comment); } public function updateComment(int $id_comment, string $comment): bool { $c = $this -> gw -> findById($id_comment); if($c){ $c -> setComment($comment); return $this->gw -> update($c); } return false; } }