|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace ApiSkeletons\Doctrine\ORM\GraphQL\Attribute; |
|
6
|
|
|
|
|
7
|
|
|
use ApiSkeletons\Doctrine\ORM\GraphQL\Filter\Filters; |
|
8
|
|
|
use Attribute; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Attribute to describe an association for GraphQL |
|
12
|
|
|
*/ |
|
13
|
|
|
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)] |
|
14
|
|
|
class Association |
|
15
|
|
|
{ |
|
16
|
|
|
use ExcludeFilters; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* @param Filters[] $excludeFilters |
|
20
|
|
|
* @param Filters[] $includeFilters |
|
21
|
|
|
*/ |
|
22
|
|
|
public function __construct( |
|
23
|
|
|
protected string $group = 'default', |
|
24
|
|
|
protected string|null $alias = null, |
|
25
|
|
|
protected string|null $description = null, |
|
26
|
|
|
protected int|null $limit = null, |
|
27
|
|
|
protected string|null $criteriaEventName = null, |
|
28
|
|
|
protected string|null $hydratorStrategy = null, |
|
29
|
|
|
array $excludeFilters = [], |
|
30
|
|
|
array $includeFilters = [], |
|
31
|
|
|
) { |
|
32
|
|
|
$this->includeFilters = $includeFilters; |
|
33
|
|
|
$this->excludeFilters = $excludeFilters; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function getAlias(): string|null |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->alias; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function getLimit(): int|null |
|
42
|
|
|
{ |
|
43
|
|
|
return $this->limit; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function getGroup(): string |
|
47
|
|
|
{ |
|
48
|
|
|
return $this->group; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function getHydratorStrategy(): string|null |
|
52
|
|
|
{ |
|
53
|
|
|
return $this->hydratorStrategy; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function getDescription(): string|null |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->description; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function getCriteriaEventName(): string|null |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->criteriaEventName; |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|