1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of EC-CUBE |
5
|
|
|
* |
6
|
|
|
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved. |
7
|
|
|
* |
8
|
|
|
* http://www.lockon.co.jp/ |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Eccube\Entity; |
15
|
|
|
|
16
|
|
|
use Doctrine\ORM\Mapping as ORM; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* PluginEventHandler |
20
|
|
|
* |
21
|
|
|
* @ORM\Table(name="dtb_plugin_event_handler") |
22
|
|
|
* @ORM\InheritanceType("SINGLE_TABLE") |
23
|
|
|
* @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255) |
24
|
|
|
* @ORM\HasLifecycleCallbacks() |
25
|
|
|
* @ORM\Entity(repositoryClass="Eccube\Repository\PluginEventHandlerRepository") |
26
|
|
|
*/ |
27
|
|
|
class PluginEventHandler extends AbstractEntity |
28
|
|
|
{ |
29
|
|
|
const EVENT_PRIORITY_LATEST = -500; // ハンドラテーブルに登録されていない場合の優先度 |
30
|
|
|
const EVENT_PRIORITY_DISABLED = 0; // ハンドラを無効にする |
31
|
|
|
|
32
|
|
|
const EVENT_PRIORITY_NORMAL_START = 400; // 先発、後発、通常の各型毎の優先度範囲 |
33
|
|
|
const EVENT_PRIORITY_NORMAL_END = -399; |
34
|
|
|
|
35
|
|
|
const EVENT_PRIORITY_FIRST_START = 500; |
36
|
|
|
const EVENT_PRIORITY_FIRST_END = 401; |
37
|
|
|
|
38
|
|
|
const EVENT_PRIORITY_LAST_START = -400; |
39
|
|
|
const EVENT_PRIORITY_LAST_END = -499; |
40
|
|
|
|
41
|
|
|
const EVENT_HANDLER_TYPE_NORMAL = 'NORMAL'; |
42
|
|
|
const EVENT_HANDLER_TYPE_FIRST = 'FIRST'; |
43
|
|
|
const EVENT_HANDLER_TYPE_LAST = 'LAST'; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var int |
47
|
|
|
* |
48
|
|
|
* @ORM\Column(name="id", type="integer", options={"unsigned":true}) |
49
|
|
|
* @ORM\Id |
50
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
51
|
|
|
*/ |
52
|
|
|
private $id; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var string |
56
|
|
|
* |
57
|
|
|
* @ORM\Column(name="event", type="string", length=255) |
58
|
|
|
*/ |
59
|
|
|
private $event; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var int |
63
|
|
|
* |
64
|
|
|
* @ORM\Column(name="priority", type="integer", options={"default":0}) |
65
|
|
|
*/ |
66
|
|
|
private $priority = 0; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @var int |
70
|
|
|
* |
71
|
|
|
* @ORM\Column(name="plugin_id", type="integer", options={"unsigned":true}) |
72
|
|
|
*/ |
73
|
|
|
private $plugin_id; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @var string |
77
|
|
|
* |
78
|
|
|
* @ORM\Column(name="handler", type="string", length=255) |
79
|
|
|
*/ |
80
|
|
|
private $handler; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @var string |
84
|
|
|
* |
85
|
|
|
* @ORM\Column(name="handler_type", type="string", length=255, nullable=false) |
86
|
|
|
*/ |
87
|
|
|
private $handler_type; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @var \DateTime |
91
|
|
|
* |
92
|
|
|
* @ORM\Column(name="create_date", type="datetimetz") |
93
|
|
|
*/ |
94
|
|
|
private $create_date; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @var \DateTime |
98
|
|
|
* |
99
|
|
|
* @ORM\Column(name="update_date", type="datetimetz") |
100
|
|
|
*/ |
101
|
|
|
private $update_date; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @var \Eccube\Entity\Plugin |
105
|
|
|
* |
106
|
|
|
* @ORM\ManyToOne(targetEntity="Eccube\Entity\Plugin", inversedBy="PluginEventHandlers") |
107
|
|
|
* @ORM\JoinColumns({ |
108
|
|
|
* @ORM\JoinColumn(name="plugin_id", referencedColumnName="id") |
109
|
|
|
* }) |
110
|
|
|
*/ |
111
|
|
|
private $Plugin; |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Get id. |
115
|
|
|
* |
116
|
|
|
* @return int |
117
|
|
|
*/ |
118
|
|
|
public function getId() |
119
|
|
|
{ |
120
|
|
|
return $this->id; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Set event. |
125
|
|
|
* |
126
|
|
|
* @param string $event |
127
|
|
|
* |
128
|
|
|
* @return PluginEventHandler |
129
|
|
|
*/ |
130
|
|
|
public function setEvent($event) |
131
|
|
|
{ |
132
|
|
|
$this->event = $event; |
133
|
|
|
|
134
|
|
|
return $this; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Get event. |
139
|
|
|
* |
140
|
|
|
* @return string |
141
|
|
|
*/ |
142
|
|
|
public function getEvent() |
143
|
|
|
{ |
144
|
|
|
return $this->event; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* Set priority. |
149
|
|
|
* |
150
|
|
|
* @param int $priority |
151
|
|
|
* |
152
|
|
|
* @return PluginEventHandler |
153
|
|
|
*/ |
154
|
|
|
public function setPriority($priority) |
155
|
|
|
{ |
156
|
|
|
$this->priority = $priority; |
157
|
|
|
|
158
|
|
|
return $this; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* Get priority. |
163
|
|
|
* |
164
|
|
|
* @return int |
165
|
|
|
*/ |
166
|
|
|
public function getPriority() |
167
|
|
|
{ |
168
|
|
|
return $this->priority; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* Set pluginId. |
173
|
|
|
* |
174
|
|
|
* @param int $pluginId |
175
|
|
|
* |
176
|
|
|
* @return PluginEventHandler |
177
|
|
|
*/ |
178
|
|
|
public function setPluginId($pluginId) |
179
|
|
|
{ |
180
|
|
|
$this->plugin_id = $pluginId; |
181
|
|
|
|
182
|
|
|
return $this; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* Get pluginId. |
187
|
|
|
* |
188
|
|
|
* @return int |
189
|
|
|
*/ |
190
|
|
|
public function getPluginId() |
191
|
|
|
{ |
192
|
|
|
return $this->plugin_id; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* Set handler. |
197
|
|
|
* |
198
|
|
|
* @param string $handler |
199
|
|
|
* |
200
|
|
|
* @return PluginEventHandler |
201
|
|
|
*/ |
202
|
|
|
public function setHandler($handler) |
203
|
|
|
{ |
204
|
|
|
$this->handler = $handler; |
205
|
|
|
|
206
|
|
|
return $this; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* Get handler. |
211
|
|
|
* |
212
|
|
|
* @return string |
213
|
|
|
*/ |
214
|
|
|
public function getHandler() |
215
|
|
|
{ |
216
|
|
|
return $this->handler; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* Set handlerType. |
221
|
|
|
* |
222
|
|
|
* @param string $handlerType |
223
|
|
|
* |
224
|
|
|
* @return PluginEventHandler |
225
|
|
|
*/ |
226
|
|
|
public function setHandlerType($handlerType) |
227
|
|
|
{ |
228
|
|
|
$this->handler_type = $handlerType; |
229
|
|
|
|
230
|
|
|
return $this; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* Get handlerType. |
235
|
|
|
* |
236
|
|
|
* @return string |
237
|
|
|
*/ |
238
|
|
|
public function getHandlerType() |
239
|
|
|
{ |
240
|
|
|
return $this->handler_type; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** |
244
|
|
|
* Set createDate. |
245
|
|
|
* |
246
|
|
|
* @param \DateTime $createDate |
247
|
|
|
* |
248
|
|
|
* @return PluginEventHandler |
249
|
|
|
*/ |
250
|
|
|
public function setCreateDate($createDate) |
251
|
|
|
{ |
252
|
|
|
$this->create_date = $createDate; |
253
|
|
|
|
254
|
|
|
return $this; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* Get createDate. |
259
|
|
|
* |
260
|
|
|
* @return \DateTime |
261
|
|
|
*/ |
262
|
|
|
public function getCreateDate() |
263
|
|
|
{ |
264
|
|
|
return $this->create_date; |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* Set updateDate. |
269
|
|
|
* |
270
|
|
|
* @param \DateTime $updateDate |
271
|
|
|
* |
272
|
|
|
* @return PluginEventHandler |
273
|
|
|
*/ |
274
|
|
|
public function setUpdateDate($updateDate) |
275
|
|
|
{ |
276
|
|
|
$this->update_date = $updateDate; |
277
|
|
|
|
278
|
|
|
return $this; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
/** |
282
|
|
|
* Get updateDate. |
283
|
|
|
* |
284
|
|
|
* @return \DateTime |
285
|
|
|
*/ |
286
|
|
|
public function getUpdateDate() |
287
|
|
|
{ |
288
|
|
|
return $this->update_date; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* Set plugin. |
293
|
|
|
* |
294
|
|
|
* @param \Eccube\Entity\Plugin|null $plugin |
295
|
|
|
* |
296
|
|
|
* @return PluginEventHandler |
297
|
|
|
*/ |
298
|
|
|
public function setPlugin(\Eccube\Entity\Plugin $plugin = null) |
299
|
|
|
{ |
300
|
|
|
$this->Plugin = $plugin; |
301
|
|
|
|
302
|
|
|
return $this; |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
/** |
306
|
|
|
* Get plugin. |
307
|
|
|
* |
308
|
|
|
* @return \Eccube\Entity\Plugin|null |
309
|
|
|
*/ |
310
|
|
|
public function getPlugin() |
311
|
|
|
{ |
312
|
|
|
return $this->Plugin; |
313
|
|
|
} |
314
|
|
|
} |
315
|
|
|
|