forked from EasyCorp/EasyAdminBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractLifecycleEvent.php
More file actions
46 lines (40 loc) · 1.18 KB
/
AbstractLifecycleEvent.php
File metadata and controls
46 lines (40 loc) · 1.18 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
<?php
namespace EasyCorp\Bundle\EasyAdminBundle\Event;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Event\EntityLifecycleEventInterface;
/**
* @author: Benjamin Leibinger <mail@leibinger.io>
*
* @template TEntity of object
*
* @implements EntityLifecycleEventInterface<TEntity>
*/
abstract class AbstractLifecycleEvent implements EntityLifecycleEventInterface
{
/**
* @var TEntity
*/
protected $entityInstance;
/**
* @param TEntity $entityInstance
*/
public function __construct(/* ?object */ $entityInstance)
{
if (!\is_object($entityInstance)
&& null !== $entityInstance) {
trigger_deprecation(
'easycorp/easyadmin-bundle',
'4.0.5',
'Argument "%s" for "%s" must be one of these types: %s. Passing type "%s" will cause an error in 5.0.0.',
'$entityInstance',
__METHOD__,
'"object" or "null"',
\gettype($entityInstance)
);
}
$this->entityInstance = $entityInstance;
}
public function getEntityInstance()/* : ?object */
{
return $this->entityInstance;
}
}