forked from FriendsOfSymfony/FOSCommentBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommentManagerInterface.php
105 lines (96 loc) · 3.01 KB
/
CommentManagerInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/**
* This file is part of the FOSCommentBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace FOS\CommentBundle\Model;
/**
* Interface to be implemented by comment managers. This adds an additional level
* of abstraction between your application, and the actual repository.
*
* All changes to comments should happen through this interface.
*
* @author Thibault Duplessis <[email protected]>
* @author Tim Nagel <[email protected]>
*/
interface CommentManagerInterface
{
/**
* Returns a flat array of comments with the specified thread.
*
* The sorter parameter should be left alone if you are sorting in the
* tree methods.
*
* @param ThreadInterface $thread
* @param integer $depth
* @param string $sorterAlias
* @return array of CommentInterface
*/
function findCommentsByThread(ThreadInterface $thread, $depth = null, $sorterAlias = null);
/*
* Returns all thread comments in a nested array
* Will typically be used when it comes to display the comments.
*
* Will query for an additional level of depth when provided
* so templates can determine to display a 'load more comments' link.
*
* @param ThreadInterface $thread
* @param string $sorter The sorter to use
* @param integer $depth
* @return array(
* 0 => array(
* 'comment' => CommentInterface,
* 'children' => array(
* 0 => array (
* 'comment' => CommentInterface,
* 'children' => array(...)
* ),
* 1 => array (
* 'comment' => CommentInterface,
* 'children' => array(...)
* )
* )
* ),
* 1 => array(
* ...
* )
*/
function findCommentTreeByThread(ThreadInterface $thread, $sorter = null, $depth = null);
/**
* Returns a partial comment tree based on a specific parent commentId.
*
* @param integer $commentId
* @param string $sorter The sorter to use
* @return array see findCommentTreeByThread()
*/
function findCommentTreeByCommentId($commentId, $sorter = null);
/**
* Adds a comment in a thread.
*
* @param CommentInterface $comment
* @param CommentInterface $parent Only used when replying to a specific CommentInterface
*/
function addComment(CommentInterface $comment);
/**
* Find one comment by its ID.
*
* @return Comment or null
*/
function findCommentById($id);
/**
* Creates an empty comment instance.
*
* @return Comment
*/
function createComment(ThreadInterface $thread, CommentInterface $comment = null);
/**
* Returns the comment fully qualified class name.
*
* @return string
*/
function getClass();
}