1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Lug package. |
5
|
|
|
* |
6
|
|
|
* (c) Eric GELOEN <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please read the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Lug\Component\Resource\Domain; |
13
|
|
|
|
14
|
|
|
use Lug\Component\Resource\Model\ResourceInterface; |
15
|
|
|
use Symfony\Component\EventDispatcher\Event; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @author GeLo <[email protected]> |
19
|
|
|
*/ |
20
|
|
|
class DomainEvent extends Event |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @var ResourceInterface |
24
|
|
|
*/ |
25
|
|
|
private $resource; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
private $action; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var mixed |
34
|
|
|
*/ |
35
|
|
|
private $data; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var int|null |
39
|
|
|
*/ |
40
|
|
|
private $statusCode; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string|null |
44
|
|
|
*/ |
45
|
|
|
private $messageType; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var string|null |
49
|
|
|
*/ |
50
|
|
|
private $message; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var bool |
54
|
|
|
*/ |
55
|
|
|
private $stopped = false; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @param ResourceInterface $resource |
59
|
|
|
* @param string $action |
60
|
|
|
* @param mixed $data |
61
|
|
|
*/ |
62
|
28 |
|
public function __construct(ResourceInterface $resource, $action, $data = null) |
63
|
|
|
{ |
64
|
28 |
|
$this->resource = $resource; |
65
|
28 |
|
$this->action = $action; |
66
|
28 |
|
$this->data = $data; |
67
|
28 |
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return ResourceInterface |
71
|
|
|
*/ |
72
|
22 |
|
public function getResource() |
73
|
|
|
{ |
74
|
22 |
|
return $this->resource; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return string |
79
|
|
|
*/ |
80
|
22 |
|
public function getAction() |
81
|
|
|
{ |
82
|
22 |
|
return $this->action; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @return mixed |
87
|
|
|
*/ |
88
|
23 |
|
public function getData() |
89
|
|
|
{ |
90
|
23 |
|
return $this->data; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @param mixed $data |
95
|
|
|
*/ |
96
|
2 |
|
public function setData($data) |
97
|
|
|
{ |
98
|
2 |
|
$this->data = $data; |
99
|
2 |
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @return int |
103
|
|
|
*/ |
104
|
11 |
|
public function getStatusCode() |
105
|
|
|
{ |
106
|
11 |
|
return $this->statusCode; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param int $statusCode |
111
|
|
|
*/ |
112
|
6 |
|
public function setStatusCode($statusCode) |
113
|
|
|
{ |
114
|
6 |
|
$this->statusCode = $statusCode; |
115
|
6 |
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return string |
119
|
|
|
*/ |
120
|
3 |
|
public function getMessageType() |
121
|
|
|
{ |
122
|
3 |
|
return $this->messageType; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @param string $messageType |
127
|
|
|
*/ |
128
|
1 |
|
public function setMessageType($messageType) |
129
|
|
|
{ |
130
|
1 |
|
$this->messageType = $messageType; |
131
|
1 |
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @return string |
135
|
|
|
*/ |
136
|
11 |
|
public function getMessage() |
137
|
|
|
{ |
138
|
11 |
|
return $this->message; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @param string $message |
143
|
|
|
*/ |
144
|
6 |
|
public function setMessage($message) |
145
|
|
|
{ |
146
|
6 |
|
$this->message = $message; |
147
|
6 |
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @return bool |
151
|
|
|
*/ |
152
|
23 |
|
public function isStopped() |
153
|
|
|
{ |
154
|
23 |
|
return $this->stopped; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @param bool $stopped |
159
|
|
|
*/ |
160
|
11 |
|
public function setStopped($stopped) |
161
|
|
|
{ |
162
|
11 |
|
$this->stopped = $stopped; |
163
|
11 |
|
} |
164
|
|
|
} |
165
|
|
|
|