1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the FOSElasticaBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> |
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 FOS\ElasticaBundle\Persister\Event; |
13
|
|
|
|
14
|
|
|
use FOS\ElasticaBundle\Persister\ObjectPersisterInterface; |
15
|
|
|
use FOS\ElasticaBundle\Provider\PagerInterface; |
16
|
|
|
use Symfony\Contracts\EventDispatcher\Event; |
17
|
|
|
|
18
|
|
|
final class OnExceptionEvent extends Event implements PersistEvent |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @var PagerInterface |
22
|
|
|
*/ |
23
|
|
|
private $pager; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var ObjectPersisterInterface |
27
|
|
|
*/ |
28
|
|
|
private $objectPersister; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var \Exception |
32
|
|
|
*/ |
33
|
|
|
private $exception; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var array |
37
|
|
|
*/ |
38
|
|
|
private $options; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var array |
42
|
|
|
*/ |
43
|
|
|
private $objects; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var bool |
47
|
|
|
*/ |
48
|
|
|
private $ignored = false; |
49
|
|
|
|
50
|
11 |
View Code Duplication |
public function __construct( |
51
|
|
|
PagerInterface $pager, |
52
|
|
|
ObjectPersisterInterface $objectPersister, |
53
|
|
|
\Exception $exception, |
54
|
|
|
array $objects, |
55
|
|
|
array $options |
56
|
|
|
) { |
57
|
11 |
|
$this->pager = $pager; |
58
|
11 |
|
$this->objectPersister = $objectPersister; |
59
|
11 |
|
$this->exception = $exception; |
60
|
11 |
|
$this->options = $options; |
61
|
11 |
|
$this->objects = $objects; |
62
|
11 |
|
} |
63
|
|
|
|
64
|
2 |
|
public function getPager(): PagerInterface |
65
|
|
|
{ |
66
|
2 |
|
return $this->pager; |
67
|
|
|
} |
68
|
|
|
|
69
|
2 |
|
public function getOptions(): array |
70
|
|
|
{ |
71
|
2 |
|
return $this->options; |
72
|
|
|
} |
73
|
|
|
|
74
|
2 |
|
public function getObjectPersister(): ObjectPersisterInterface |
75
|
|
|
{ |
76
|
2 |
|
return $this->objectPersister; |
77
|
|
|
} |
78
|
|
|
|
79
|
3 |
|
public function getException(): \Exception |
80
|
|
|
{ |
81
|
3 |
|
return $this->exception; |
82
|
|
|
} |
83
|
|
|
|
84
|
1 |
|
public function setException(\Exception $exception) |
85
|
|
|
{ |
86
|
1 |
|
$this->exception = $exception; |
87
|
1 |
|
} |
88
|
|
|
|
89
|
4 |
|
public function isIgnored(): bool |
90
|
|
|
{ |
91
|
4 |
|
return $this->ignored; |
92
|
|
|
} |
93
|
|
|
|
94
|
2 |
|
public function setIgnored(bool $ignored) |
95
|
|
|
{ |
96
|
2 |
|
$this->ignored = $ignored; |
97
|
2 |
|
} |
98
|
|
|
|
99
|
1 |
|
public function getObjects(): array |
100
|
|
|
{ |
101
|
1 |
|
return $this->objects; |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|