Completed
Push — 10.1.x ( 42efc1...d78d9e )
by Tom
31s queued 16s
created

Association   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 51
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getLimit() 0 3 1
A getGroup() 0 3 1
A getHydratorStrategy() 0 3 1
A getDescription() 0 3 1
A __construct() 0 12 1
A getAlias() 0 3 1
A getCriteriaEventName() 0 3 1
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