-
Notifications
You must be signed in to change notification settings - Fork 3
/
AbstractRefresh.php
36 lines (28 loc) · 947 Bytes
/
AbstractRefresh.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
namespace Valantic\ElasticaBridgeBundle\Messenger\Message;
use Pimcore\Model\Element\ElementInterface;
abstract class AbstractRefresh
{
/** @var class-string<ElementInterface> */
public string $className;
public int $id;
private bool $shouldStopEventPropagation = false;
public function isEventPropagationStopped(): bool
{
return $this->shouldStopEventPropagation;
}
public function stopEventPropagation(): void
{
$this->setShouldStopEventPropagation(true);
}
protected function setElement(ElementInterface $element): void
{
$this->className = $element::class;
$this->id = $element->getId() ?? throw new \InvalidArgumentException('Pimcore ID is null.');
}
protected function setShouldStopEventPropagation(bool $stopEventPropagation): void
{
$this->shouldStopEventPropagation = $stopEventPropagation;
}
}