You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
871 B

7 years ago
<?php
namespace core\services\post;
use core\forms\post\PostCommentEditForm;
use core\repositories\post\PostRepository;
class PostCommentManageService
{
3 years ago
private PostRepository $posts;
7 years ago
public function __construct(PostRepository $posts)
{
$this->posts = $posts;
}
public function edit($postId, $id, PostCommentEditForm $form): void
{
$post = $this->posts->get($postId);
$post->editComment($id, $form->parentId, $form->text);
$this->posts->save($post);
}
public function activate($postId, $id): void
{
$post = $this->posts->get($postId);
$post->activateComment($id);
$this->posts->save($post);
}
public function remove($postId, $id): void
{
$post = $this->posts->get($postId);
$post->removeComment($id);
$this->posts->save($post);
}
3 years ago
}