1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the MilioooMessageBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Michiel boeckaert <[email protected]> |
7
|
|
|
* This source file is subject to the MIT license that is bundled |
8
|
|
|
* with this source code in the file LICENSE. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Miliooo\Messaging\Model; |
12
|
|
|
|
13
|
|
|
use Miliooo\Messaging\User\ParticipantInterface; |
14
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* The message Interface |
18
|
|
|
* |
19
|
|
|
* @author Michiel Boeckaert <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
interface MessageInterface extends BuilderInterface |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* Gets the unique id of the message |
25
|
|
|
* |
26
|
|
|
* @return integer The unique id of the message |
27
|
|
|
*/ |
28
|
|
|
public function getId(); |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Gets the creation time of the message |
32
|
|
|
* |
33
|
|
|
* @return \DateTime |
34
|
|
|
*/ |
35
|
|
|
public function getCreatedAt(); |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Sets the creation time of the message |
39
|
|
|
* |
40
|
|
|
* @param \DateTime $createdAt The time the message was created |
41
|
|
|
*/ |
42
|
|
|
public function setCreatedAt(\DateTime $createdAt); |
|
|
|
|
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Gets the body of the message |
46
|
|
|
* |
47
|
|
|
* @return string The body |
48
|
|
|
*/ |
49
|
|
|
public function getBody(); |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Sets the body of the message |
53
|
|
|
* |
54
|
|
|
* @param string $body The body |
55
|
|
|
*/ |
56
|
|
|
public function setBody($body); |
|
|
|
|
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Sets the sender of the message |
60
|
|
|
* |
61
|
|
|
* @param ParticipantInterface $sender The sender of the message |
62
|
|
|
*/ |
63
|
|
|
public function setSender(ParticipantInterface $sender); |
|
|
|
|
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Gets the sender of the message |
67
|
|
|
* |
68
|
|
|
* @return ParticipantInterface |
69
|
|
|
*/ |
70
|
|
|
public function getSender(); |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Adds message meta to the messageMeta collection |
74
|
|
|
* |
75
|
|
|
* @param MessageMetaInterface $messageMeta |
76
|
|
|
*/ |
77
|
|
|
public function addMessageMeta(MessageMetaInterface $messageMeta); |
|
|
|
|
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Returns an array collection with message meta |
81
|
|
|
* |
82
|
|
|
* @return ArrayCollection An ArrayCollection of messageMeta |
83
|
|
|
*/ |
84
|
|
|
public function getMessageMeta(); |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Gets message meta for the given participant |
88
|
|
|
* |
89
|
|
|
* @param ParticipantInterface $participant The participant |
90
|
|
|
* |
91
|
|
|
* @return MessageMetaInterface|null The messagemeta or null when not found |
92
|
|
|
*/ |
93
|
|
|
public function getMessageMetaForParticipant(ParticipantInterface $participant); |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Sets the thread this message belongs to |
97
|
|
|
* |
98
|
|
|
* @param ThreadInterface $thread The thread this message belongs to |
99
|
|
|
*/ |
100
|
|
|
public function setThread(ThreadInterface $thread); |
|
|
|
|
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Gets the thread this message belongs to |
104
|
|
|
* |
105
|
|
|
* @return ThreadInterface the thread this message belongs to |
106
|
|
|
*/ |
107
|
|
|
public function getThread(); |
108
|
|
|
} |
109
|
|
|
|
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@return
doc comment to communicate to implementors of these methods what they are expected to return.