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\Builder\Model; |
12
|
|
|
|
13
|
|
|
use Miliooo\Messaging\Form\FormModel\NewThreadInterface; |
14
|
|
|
use Miliooo\Messaging\Model\ThreadMetaInterface; |
15
|
|
|
use Miliooo\Messaging\User\ParticipantInterface; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* ThreadBuilderModel. |
19
|
|
|
* |
20
|
|
|
* The thread builder model contains all the data needed to build a new thread object. |
21
|
|
|
* |
22
|
|
|
* @author Michiel Boeckaert <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
class ThreadBuilderModel extends AbstractMessageBuilderModel |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* @var NewThreadInterface |
28
|
|
|
*/ |
29
|
|
|
protected $newThreadModel; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Constructor. |
33
|
|
|
* |
34
|
|
|
* @param NewThreadInterface $newThreadModel |
35
|
|
|
*/ |
36
|
|
|
public function __construct(NewThreadInterface $newThreadModel) |
37
|
|
|
{ |
38
|
|
|
$this->newThreadModel = $newThreadModel; |
39
|
|
|
|
40
|
|
|
parent::__construct($newThreadModel); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* {@inheritdoc} |
45
|
|
|
*/ |
46
|
|
|
protected function processExtra() |
47
|
|
|
{ |
48
|
|
|
$this->addThreadData('subject', $this->newThreadModel->getSubject()); |
49
|
|
|
$this->addThreadData('createdAt', $this->newThreadModel->getCreatedAt()); |
50
|
|
|
$this->addThreadData('createdBy', $this->newThreadModel->getSender()); |
51
|
|
|
$this->addThreadMeta(self::ALL, 'status', ThreadMetaInterface::STATUS_ACTIVE); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Gets the recipients of the new message |
56
|
|
|
* |
57
|
|
|
* @return ParticipantInterface[] Array with participants |
58
|
|
|
*/ |
59
|
|
|
public function getRecipients() |
60
|
|
|
{ |
61
|
|
|
return $this->newThreadModel->getRecipients(); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|