1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace ApiSkeletons\Doctrine\GraphQL\Attribute; |
6
|
|
|
|
7
|
|
|
use Attribute; |
8
|
|
|
|
9
|
|
|
#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] |
10
|
|
|
final class Entity |
11
|
|
|
{ |
12
|
|
|
use ExcludeCriteria; |
|
|
|
|
13
|
|
|
|
14
|
|
|
/** @var string The GraphQL group */ |
15
|
|
|
private string $group; |
16
|
|
|
|
17
|
|
|
/** @var bool Extract by value: true, or by reference: false */ |
18
|
|
|
private bool $byValue; |
19
|
|
|
|
20
|
|
|
/** @var string|null Documentation for the entity within GraphQL */ |
21
|
|
|
private string|null $description = null; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var mixed[] An array of filters as |
25
|
|
|
* [ |
26
|
|
|
* 'condition' => FilterComposite::CONDITION_AND, |
27
|
|
|
* 'filter' => 'Filter\ClassName', |
28
|
|
|
* ] |
29
|
|
|
*/ |
30
|
|
|
private array $filters = []; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @param mixed[] $filters |
34
|
|
|
* @param string[] $excludeCriteria |
35
|
|
|
* @param string[] $includeCriteria |
36
|
|
|
*/ |
37
|
|
|
public function __construct( |
38
|
|
|
string $group = 'default', |
39
|
|
|
bool $byValue = true, |
40
|
|
|
string|null $description = null, |
41
|
|
|
private string|null $typeName = null, |
42
|
|
|
array $filters = [], |
43
|
|
|
private string|null $namingStrategy = null, |
44
|
|
|
private array $excludeCriteria = [], |
45
|
|
|
private array $includeCriteria = [], |
46
|
|
|
) { |
47
|
|
|
$this->group = $group; |
48
|
|
|
$this->byValue = $byValue; |
49
|
|
|
$this->description = $description; |
50
|
|
|
$this->filters = $filters; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function getGroup(): string|null |
54
|
|
|
{ |
55
|
|
|
return $this->group; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function getByValue(): bool |
59
|
|
|
{ |
60
|
|
|
return $this->byValue; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function getDescription(): string|null |
64
|
|
|
{ |
65
|
|
|
return $this->description; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function getTypeName(): string|null |
69
|
|
|
{ |
70
|
|
|
return $this->typeName; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** @return mixed[] */ |
74
|
|
|
public function getFilters(): array |
75
|
|
|
{ |
76
|
|
|
return $this->filters; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function getNamingStrategy(): string|null |
80
|
|
|
{ |
81
|
|
|
return $this->namingStrategy; |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|