Updated: Comment #0

Problem/Motivation

There's a CommentManager that could be overriden in contrib but without Interface definition
Also we need to inject the service to other services and controllers and it better to make via interface

Proposed resolution

Add interface

Related issues
#2097123: Deprecate comment_num_new() in favour of method on CommentManager

Files: 
CommentFileSizeAuthor
#4 interdiff.txt4.52 KBandypost
#4 drupal8.comment-module.2101155-4.patch11.33 KBandypost
PASSED: [[SimpleTest]]: [MySQL] 58,681 pass(es).
[ View ]
#1 2101155-commentManagerInterface-1.patch6.8 KBandypost
PASSED: [[SimpleTest]]: [MySQL] 59,149 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new6.8 KB
PASSED: [[SimpleTest]]: [MySQL] 59,149 pass(es).
[ View ]

maybe change doc block of implementation to 'Provides comment manager service'?

Will review today

Status:Needs review» Reviewed & tested by the community

+++ b/core/modules/comment/lib/Drupal/comment/CommentManagerInterface.php
@@ -0,0 +1,87 @@
+  public function getParentEntityUri(CommentInterface $comment);

I still think this belongs on CommentInterface but thats for another issue.

StatusFileSize
new11.33 KB
PASSED: [[SimpleTest]]: [MySQL] 58,681 pass(es).
[ View ]
new4.52 KB

Let's add actual usage

Awesome RTBC +1

Thanks for cleaning up refs here, +1

Title:Add CommentManagerInterfaceChange notice: Add CommentManagerInterface
Priority:Normal» Major
Status:Reviewed & tested by the community» Active
Issue tags:+Needs change record

Committed and pushed to 8.x. Thanks!

This needs a change notice.

Filed initial change notice https://drupal.org/node/2112417 suppose we should extend it latter when more functions would be approved to be converted to swappable implementation, for example #2111357: Get rid of comment_count_unpublished() in favor of CommentManager method

PS: #3 addressed in #2111419: Remove CommentManager::getParentEntityUri() in favor of Comment::permalink()

Priority:Major» Normal
Status:Active» Fixed
Issue tags:-Needs change record

Title:Change notice: Add CommentManagerInterfaceAdd CommentManagerInterface

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Issue summary:View changes

2097123