diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 58b3043..966149b 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -24,7 +24,6 @@ use Modules\Comments\Models\CommentListMapper; use Modules\Comments\Models\CommentMapper; use Modules\Comments\Models\CommentVote; use Modules\Comments\Models\CommentVoteMapper; -use Modules\Comments\Models\NullCommentVote; use Modules\Media\Models\CollectionMapper; use Modules\Media\Models\MediaMapper; use Modules\Media\Models\NullMedia; @@ -191,22 +190,22 @@ final class ApiController extends Controller foreach ($uploaded as $media) { $this->createModelRelation( $request->header->account, - $comment->getId(), - $media->getId(), + $comment->id, + $media->id, CommentMapper::class, 'media', '', $request->getOrigin() ); - $accountPath = '/Accounts/' . $account->getId() . ' ' . $account->login + $accountPath = '/Accounts/' . $account->id . ' ' . $account->login . '/Comments/' . $comment->createdAt->format('Y') . '/' . $comment->createdAt->format('m') - . '/' . $comment->getId(); + . '/' . $comment->id; $ref = new Reference(); $ref->name = $media->name; - $ref->source = new NullMedia($media->getId()); + $ref->source = new NullMedia($media->id); $ref->createdBy = new NullAccount($request->header->account); $ref->setVirtualPath($accountPath); @@ -216,14 +215,14 @@ final class ApiController extends Controller $collection = $this->app->moduleManager->get('Media')->createRecursiveMediaCollection( $accountPath, $request->header->account, - __DIR__ . '/../../../Modules/Media/Files/Accounts/' . $account->getId() . '/Comments/' . $comment->createdAt->format('Y') . '/' . $comment->createdAt->format('m') . '/' . $comment->getId() + __DIR__ . '/../../../Modules/Media/Files/Accounts/' . $account->id . '/Comments/' . $comment->createdAt->format('Y') . '/' . $comment->createdAt->format('m') . '/' . $comment->id ); } $this->createModelRelation( $request->header->account, - $collection->getId(), - $ref->getId(), + $collection->id, + $ref->id, CollectionMapper::class, 'sources', '', @@ -240,8 +239,8 @@ final class ApiController extends Controller $media = MediaMapper::get()->where('id', (int) $file)->limit(1)->execute(); $this->createModelRelation( $request->header->account, - $comment->getId(), - $media->getId(), + $comment->id, + $media->id, CommentMapper::class, 'media', '', @@ -250,7 +249,7 @@ final class ApiController extends Controller $ref = new Reference(); $ref->name = $media->name; - $ref->source = new NullMedia($media->getId()); + $ref->source = new NullMedia($media->id); $ref->createdBy = new NullAccount($request->header->account); $ref->setVirtualPath($path); @@ -266,8 +265,8 @@ final class ApiController extends Controller $this->createModelRelation( $request->header->account, - $collection->getId(), - $ref->getId(), + $collection->id, + $ref->id, CollectionMapper::class, 'sources', '', @@ -292,7 +291,7 @@ final class ApiController extends Controller . $comment->createdAt->format('Y') . '/' . $comment->createdAt->format('m') . '/' . $comment->createdAt->format('d') . '/' - . $comment->getId(); + . $comment->id; } /** @@ -448,7 +447,7 @@ final class ApiController extends Controller /** @var \Modules\Comments\Models\CommentVote $vote */ $vote = CommentVoteMapper::findVote((int) $request->getData('id'), $request->header->account); - if ($vote instanceof NullCommentVote) { + if ($vote->id === 0) { $new = new CommentVote(); $new->score = (int) $request->getData('type'); $new->comment = (int) $request->getData('id'); diff --git a/Models/Comment.php b/Models/Comment.php index 9ede7d8..8affe81 100755 --- a/Models/Comment.php +++ b/Models/Comment.php @@ -34,7 +34,7 @@ class Comment implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Account. @@ -74,7 +74,7 @@ class Comment implements \JsonSerializable * @var int * @since 1.0.0 */ - private int $status = CommentStatus::VISIBLE; + public int $status = CommentStatus::VISIBLE; /** * Content diff --git a/Models/CommentList.php b/Models/CommentList.php index 0e9ea6e..769b7be 100755 --- a/Models/CommentList.php +++ b/Models/CommentList.php @@ -30,7 +30,7 @@ class CommentList * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Comments diff --git a/Models/CommentVote.php b/Models/CommentVote.php index e95625c..11735ca 100755 --- a/Models/CommentVote.php +++ b/Models/CommentVote.php @@ -32,7 +32,7 @@ class CommentVote * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Account. diff --git a/Theme/Backend/Components/Comment/list.tpl.php b/Theme/Backend/Components/Comment/list.tpl.php index d8d6cb0..9796d44 100755 --- a/Theme/Backend/Components/Comment/list.tpl.php +++ b/Theme/Backend/Components/Comment/list.tpl.php @@ -23,7 +23,7 @@ $comments = $this->commentList->getComments();
-
+