forked from FriendsOfSymfony/FOSMessageBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ThreadManagerInterface.php
139 lines (124 loc) · 4.51 KB
/
ThreadManagerInterface.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
namespace FOS\MessageBundle\ModelManager;
use FOS\MessageBundle\Model\ParticipantInterface;
use FOS\MessageBundle\Model\ThreadInterface;
/**
* Interface to be implemented by comment thread managers. This adds an additional level
* of abstraction between your application, and the actual repository.
*
* All changes to comment threads should happen through this interface.
*
* @author Thibault Duplessis <[email protected]>
*/
interface ThreadManagerInterface extends ReadableManagerInterface
{
/**
* Finds a thread by its ID
*
* @return ThreadInterface or null
*/
function findThreadById($id);
/**
* Finds not deleted threads for a participant,
* containing at least one message not written by this participant,
* ordered by last message not written by this participant in reverse order.
* In one word: an inbox.
*
* @param ParticipantInterface $participant
* @return Builder a query builder suitable for pagination
*/
function getParticipantInboxThreadsQueryBuilder(ParticipantInterface $participant);
/**
* Finds not deleted threads for a participant,
* containing at least one message not written by this participant,
* ordered by last message not written by this participant in reverse order.
* In one word: an inbox.
*
* @param ParticipantInterface $participant
* @return array of ThreadInterface
*/
function findParticipantInboxThreads(ParticipantInterface $participant);
/**
* Finds not deleted threads from a participant,
* containing at least one message written by this participant,
* ordered by last message written by this participant in reverse order.
* In one word: an sentbox.
*
* @param ParticipantInterface $participant
* @return Builder a query builder suitable for pagination
*/
function getParticipantSentThreadsQueryBuilder(ParticipantInterface $participant);
/**
* Finds not deleted threads from a participant,
* containing at least one message written by this participant,
* ordered by last message written by this participant in reverse order.
* In one word: an sentbox.
*
* @param ParticipantInterface $participant
* @return array of ThreadInterface
*/
function findParticipantSentThreads(ParticipantInterface $participant);
/**
* Finds deleted threads from a participant,
* ordered by last message date
*
* @param ParticipantInterface $participant
* @return Builder a query builder suitable for pagination
*/
function getParticipantDeletedThreadsQueryBuilder(ParticipantInterface $participant);
/**
* Finds deleted threads from a participant,
* ordered by last message date
*
* @param ParticipantInterface $participant
* @return ThreadInterface[]
*/
function findParticipantDeletedThreads(ParticipantInterface $participant);
/**
* Finds not deleted threads for a participant,
* matching the given search term
* ordered by last message not written by this participant in reverse order.
*
* @param ParticipantInterface $participant
* @param string $search
* @return Builder a query builder suitable for pagination
*/
function getParticipantThreadsBySearchQueryBuilder(ParticipantInterface $participant, $search);
/**
* Finds not deleted threads for a participant,
* matching the given search term
* ordered by last message not written by this participant in reverse order.
*
* @param ParticipantInterface $participant
* @param string $search
* @return array of ThreadInterface
*/
function findParticipantThreadsBySearch(ParticipantInterface $participant, $search);
/**
* Gets threads created by a participant
*
* @param ParticipantInterface $participant
* @return array of ThreadInterface
*/
function findThreadsCreatedBy(ParticipantInterface $participant);
/**
* Creates an empty comment thread instance
*
* @return ThreadInterface
*/
function createThread();
/**
* Saves a thread
*
* @param ThreadInterface $thread
* @param Boolean $andFlush Whether to flush the changes (default true)
*/
function saveThread(ThreadInterface $thread, $andFlush = true);
/**
* Deletes a thread
* This is not participant deletion but real deletion
*
* @param ThreadInterface $thread the thread to delete
*/
function deleteThread(ThreadInterface $thread);
}