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.
37 lines
855 B
37 lines
855 B
7 years ago
|
<?php
|
||
|
|
||
|
namespace core\services\post;
|
||
|
|
||
|
use core\forms\post\PostCommentEditForm;
|
||
|
use core\repositories\post\PostRepository;
|
||
|
|
||
|
class PostCommentManageService
|
||
|
{
|
||
|
private $posts;
|
||
|
|
||
|
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);
|
||
|
}
|
||
|
}
|