|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Doctrine\ORM\Event; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\Common\Persistence\Event\ManagerEventArgs; |
|
8
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
9
|
|
|
use Doctrine\ORM\Mapping\ClassMetadata; |
|
10
|
|
|
use Doctrine\ORM\Mapping\ClassMetadataBuildingContext; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Class that holds event arguments for a `onClassMetadataNotFound` event. |
|
14
|
|
|
* |
|
15
|
|
|
* This object is mutable by design, allowing callbacks having access to it to set the |
|
16
|
|
|
* found metadata in it, and therefore "cancelling" a `onClassMetadataNotFound` event |
|
17
|
|
|
* |
|
18
|
|
|
* @package Doctrine\ORM\Event |
|
19
|
|
|
* @since 2.5 |
|
20
|
|
|
* |
|
21
|
|
|
* @author Guilherme Blanco <[email protected]> |
|
22
|
|
|
* @author Marco Pivetta <[email protected]> |
|
23
|
|
|
*/ |
|
24
|
|
|
class OnClassMetadataNotFoundEventArgs extends ManagerEventArgs |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* @var string |
|
28
|
|
|
*/ |
|
29
|
|
|
private $className; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var ClassMetadataBuildingContext |
|
33
|
|
|
*/ |
|
34
|
|
|
private $metadataBuildingContext; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var ClassMetadata|null |
|
38
|
|
|
*/ |
|
39
|
|
|
private $foundMetadata; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Constructor. |
|
43
|
|
|
* |
|
44
|
|
|
* @param string $className |
|
45
|
|
|
* @param ClassMetadataBuildingContext $metadataBuildingContext |
|
46
|
|
|
* @param EntityManagerInterface $entityManager |
|
47
|
|
|
*/ |
|
48
|
|
|
public function __construct( |
|
49
|
|
|
string $className, |
|
50
|
|
|
ClassMetadataBuildingContext $metadataBuildingContext, |
|
51
|
|
|
EntityManagerInterface $entityManager |
|
52
|
|
|
) |
|
53
|
3 |
|
{ |
|
54
|
|
|
parent::__construct($entityManager); |
|
55
|
3 |
|
|
|
56
|
|
|
$this->className = $className; |
|
57
|
3 |
|
$this->metadataBuildingContext = $metadataBuildingContext; |
|
58
|
3 |
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @param ClassMetadata|null $classMetadata |
|
62
|
|
|
* |
|
63
|
3 |
|
* @return void |
|
64
|
|
|
*/ |
|
65
|
3 |
|
public function setFoundMetadata(?ClassMetadata $classMetadata) : void |
|
66
|
3 |
|
{ |
|
67
|
|
|
$this->foundMetadata = $classMetadata; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
3 |
|
* @return ClassMetadata|null |
|
72
|
|
|
*/ |
|
73
|
3 |
|
public function getFoundMetadata() : ?ClassMetadata |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->foundMetadata; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Retrieve class name for which a failed metadata fetch attempt was executed |
|
80
|
|
|
* |
|
81
|
3 |
|
* @return string |
|
82
|
|
|
*/ |
|
83
|
3 |
|
public function getClassName() : string |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->className; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @return ClassMetadataBuildingContext |
|
90
|
|
|
*/ |
|
91
|
|
|
public function getClassMetadataBuildingContext() : ClassMetadataBuildingContext |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->metadataBuildingContext; |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
|