forked from pimcore/pimcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataObjectPreLoadEvent.php
More file actions
57 lines (48 loc) · 1.4 KB
/
DataObjectPreLoadEvent.php
File metadata and controls
57 lines (48 loc) · 1.4 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
declare(strict_types=1);
/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/
namespace Pimcore\Event\Model;
use Pimcore\Event\Traits\ArgumentsAwareTrait;
use Pimcore\Model\DataObject\AbstractObject;
use Pimcore\Model\Exception\NotFoundException;
use Symfony\Contracts\EventDispatcher\Event;
class DataObjectPreLoadEvent extends Event implements ElementEventInterface
{
use ArgumentsAwareTrait;
protected ?AbstractObject $object;
/**
* DataObjectEvent constructor.
*
*/
public function __construct(?AbstractObject $object, array $arguments = [])
{
$this->object = $object;
$this->arguments = $arguments;
}
public function getObject(): AbstractObject
{
if ($this->object === null) {
throw new NotFoundException();
}
return $this->object;
}
public function setObject(?AbstractObject $object): void
{
$this->object = $object;
}
public function getElement(): AbstractObject
{
return $this->getObject();
}
}