1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Sonata Project package. |
5
|
|
|
* |
6
|
|
|
* (c) Thomas Rabaix <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Sonata\NotificationBundle\Event; |
13
|
|
|
|
14
|
|
|
use Sonata\NotificationBundle\Backend\BackendInterface; |
15
|
|
|
use Sonata\NotificationBundle\Iterator\MessageIteratorInterface; |
16
|
|
|
use Sonata\NotificationBundle\Model\MessageInterface; |
17
|
|
|
use Symfony\Component\EventDispatcher\Event; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Event for ConsumerHandlerCommand iterations event. |
21
|
|
|
* |
22
|
|
|
* @author Kevin Nedelec <[email protected]> |
23
|
|
|
* |
24
|
|
|
* Class IterateEvent |
25
|
|
|
*/ |
26
|
|
|
class IterateEvent extends Event |
27
|
|
|
{ |
28
|
|
|
const EVENT_NAME = 'sonata.notification.event.message_iterate_event'; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var MessageIteratorInterface |
32
|
|
|
*/ |
33
|
|
|
protected $iterator; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var BackendInterface |
37
|
|
|
*/ |
38
|
|
|
protected $backend; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var MessageInterface |
42
|
|
|
*/ |
43
|
|
|
protected $message; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @param MessageIteratorInterface $iterator |
47
|
|
|
* @param BackendInterface $backend |
48
|
|
|
* @param MessageInterface $message |
49
|
|
|
*/ |
50
|
|
|
public function __construct(MessageIteratorInterface $iterator, BackendInterface $backend = null, MessageInterface $message = null) |
51
|
|
|
{ |
52
|
|
|
$this->iterator = $iterator; |
53
|
|
|
$this->backend = $backend; |
54
|
|
|
$this->message = $message; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @return BackendInterface |
59
|
|
|
*/ |
60
|
|
|
public function getBackend() |
61
|
|
|
{ |
62
|
|
|
return $this->backend; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return MessageIteratorInterface |
67
|
|
|
*/ |
68
|
|
|
public function getIterator() |
69
|
|
|
{ |
70
|
|
|
return $this->iterator; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return MessageInterface |
75
|
|
|
*/ |
76
|
|
|
public function getMessage() |
77
|
|
|
{ |
78
|
|
|
return $this->message; |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|