| Total Complexity | 7 |
| Total Lines | 83 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 |
||
| 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 |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * TODO Should it be moved somewhere else? |
||
| 84 | * |
||
| 85 | * @return string|null |
||
| 86 | */ |
||
| 87 | public function getAlias(): ?string |
||
| 90 | } |
||
| 91 | } |
||
| 92 |