Passed
Pull Request — master (#9)
by Mariusz
02:39
created

AssociationBuilder::loadFull()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Xsolve\Associate\DoctrineOrm\Association\Path\Builder;
4
5
use Xsolve\Associate\DoctrineOrm\Association\Path\AssociationPath;
6
7
class AssociationBuilder
8
{
9
    /**
10
     * @var AssociationPathBuilder
11
     */
12
    protected $rootBuilder;
13
14
    /**
15
     * @var string
16
     */
17
    protected $loadMode = 'proxy';
18
19
    /**
20
     * @var ?string
21
     */
22
    protected $alias;
23
24
    /**
25
     * @param AssociationPathBuilder $rootBuilder
26
     */
27
    public function __construct(AssociationPathBuilder $rootBuilder)
28
    {
29
        $this->rootBuilder = $rootBuilder;
30
    }
31
32
    /**
33
     * @param string $alias
34
     *
35
     * @return self
36
     */
37
    public function aliasAs(string $alias): self
38
    {
39
        $this->alias = $alias;
40
41
        return $this;
42
    }
43
44
    /**
45
     * @return self
46
     */
47
    public function loadFull(): self
48
    {
49
        $this->loadMode = 'full';
50
51
        return $this;
52
    }
53
54
    /**
55
     * @param string $relationshipName
56
     *
57
     * @return self
58
     */
59
    public function associate(string $relationshipName): self
60
    {
61
        return $this->rootBuilder->associate($relationshipName);
62
    }
63
64
    /**
65
     * @return AssociationPath
66
     */
67
    public function create(): AssociationPath
68
    {
69
        return $this->rootBuilder->create();
70
    }
71
72
    /**
73
     * TODO Should it be moved somewhere else?
74
     *
75
     * @return string
76
     */
77
    public function getLoadMode(): string
78
    {
79
        return $this->loadMode;
80
    }
81
82
    /**
83
     * TODO Should it be moved somewhere else?
84
     *
85
     * @return string|null
86
     */
87
    public function getAlias(): ?string
88
    {
89
        return $this->alias;
90
    }
91
}
92