1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace ApiSkeletons\Doctrine\ORM\GraphQL\Event; |
6
|
|
|
|
7
|
|
|
use Doctrine\Common\Collections\Collection; |
8
|
|
|
use Doctrine\Common\Collections\Criteria as DoctrineCriteria; |
9
|
|
|
use Doctrine\ORM\PersistentCollection; |
10
|
|
|
use GraphQL\Type\Definition\ResolveInfo; |
11
|
|
|
use League\Event\HasEventName; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* This event is dispatched when a Doctrine Criteria is created. |
15
|
|
|
* Define an event using the Association::$criteriaEventName |
16
|
|
|
*/ |
17
|
|
|
class Criteria implements |
18
|
|
|
HasEventName |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @param PersistentCollection<array-key, mixed> $collection |
22
|
|
|
* @param mixed[] $args |
23
|
|
|
*/ |
24
|
|
|
public function __construct( |
25
|
|
|
protected readonly DoctrineCriteria $criteria, |
26
|
|
|
protected readonly string $eventName, |
27
|
|
|
protected readonly Collection $collection, |
28
|
|
|
protected readonly mixed $objectValue, |
29
|
|
|
protected readonly array $args, |
30
|
|
|
protected readonly mixed $context, |
31
|
|
|
protected readonly ResolveInfo $info, |
32
|
|
|
) { |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function eventName(): string |
36
|
|
|
{ |
37
|
|
|
return $this->eventName; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function getCriteria(): DoctrineCriteria |
41
|
|
|
{ |
42
|
|
|
return $this->criteria; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** @return PersistentCollection<array-key, mixed> */ |
46
|
|
|
public function getCollection(): Collection |
47
|
|
|
{ |
48
|
|
|
return $this->collection; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function getObjectValue(): mixed |
52
|
|
|
{ |
53
|
|
|
return $this->objectValue; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** @return mixed[] */ |
57
|
|
|
public function getArgs(): array |
58
|
|
|
{ |
59
|
|
|
return $this->args; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function getContext(): mixed |
63
|
|
|
{ |
64
|
|
|
return $this->context; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function getInfo(): ResolveInfo |
68
|
|
|
{ |
69
|
|
|
return $this->info; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|