|
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
|
|
|
class OnClassMetadataNotFoundEventArgs extends ManagerEventArgs |
|
19
|
|
|
{ |
|
20
|
|
|
/** @var string */ |
|
21
|
|
|
private $className; |
|
22
|
|
|
|
|
23
|
|
|
/** @var ClassMetadataBuildingContext */ |
|
24
|
|
|
private $metadataBuildingContext; |
|
25
|
|
|
|
|
26
|
|
|
/** @var ClassMetadata|null */ |
|
27
|
|
|
private $foundMetadata; |
|
28
|
|
|
|
|
29
|
|
|
/** @var EntityManagerInterface */ |
|
30
|
|
|
private $entityManager; |
|
31
|
|
|
|
|
32
|
3 |
|
public function __construct( |
|
33
|
|
|
string $className, |
|
34
|
|
|
ClassMetadataBuildingContext $metadataBuildingContext, |
|
35
|
|
|
EntityManagerInterface $entityManager |
|
36
|
|
|
) { |
|
37
|
3 |
|
$this->className = $className; |
|
38
|
3 |
|
$this->metadataBuildingContext = $metadataBuildingContext; |
|
39
|
3 |
|
$this->entityManager = $entityManager; |
|
40
|
3 |
|
} |
|
41
|
|
|
|
|
42
|
3 |
|
public function setFoundMetadata(?ClassMetadata $classMetadata) : void |
|
43
|
|
|
{ |
|
44
|
3 |
|
$this->foundMetadata = $classMetadata; |
|
45
|
3 |
|
} |
|
46
|
|
|
|
|
47
|
3 |
|
public function getFoundMetadata() : ?ClassMetadata |
|
48
|
|
|
{ |
|
49
|
3 |
|
return $this->foundMetadata; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Retrieve class name for which a failed metadata fetch attempt was executed |
|
54
|
|
|
*/ |
|
55
|
3 |
|
public function getClassName() : string |
|
56
|
|
|
{ |
|
57
|
3 |
|
return $this->className; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
1 |
|
public function getClassMetadataBuildingContext() : ClassMetadataBuildingContext |
|
61
|
|
|
{ |
|
62
|
1 |
|
return $this->metadataBuildingContext; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
3 |
|
public function getObjectManager() |
|
66
|
|
|
{ |
|
67
|
3 |
|
return $this->entityManager; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|