1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Cycle\Schema\Definition; |
||
6 | |||
7 | final class ForeignKey |
||
8 | { |
||
9 | /** |
||
10 | * @var non-empty-string |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
11 | */ |
||
12 | private string $target; |
||
13 | |||
14 | /** |
||
15 | * @var array<non-empty-string> |
||
0 ignored issues
–
show
|
|||
16 | */ |
||
17 | private array $innerColumns; |
||
18 | |||
19 | /** |
||
20 | * @var array<non-empty-string> |
||
0 ignored issues
–
show
|
|||
21 | */ |
||
22 | private array $outerColumns; |
||
23 | |||
24 | private bool $createIndex; |
||
25 | |||
26 | /** |
||
27 | * @var non-empty-string |
||
0 ignored issues
–
show
|
|||
28 | */ |
||
29 | private string $action; |
||
30 | |||
31 | /** |
||
32 | * @param non-empty-string $target |
||
0 ignored issues
–
show
|
|||
33 | */ |
||
34 | public function setTarget(string $target): self |
||
35 | { |
||
36 | $this->target = $target; |
||
37 | |||
38 | return $this; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @return non-empty-string |
||
0 ignored issues
–
show
|
|||
43 | */ |
||
44 | public function getTarget(): string |
||
45 | { |
||
46 | return $this->target; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * @param array<non-empty-string> $columns |
||
0 ignored issues
–
show
|
|||
51 | */ |
||
52 | public function setInnerColumns(array $columns): self |
||
53 | { |
||
54 | $this->innerColumns = $columns; |
||
55 | |||
56 | return $this; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @return array<non-empty-string> |
||
0 ignored issues
–
show
|
|||
61 | */ |
||
62 | public function getInnerColumns(): array |
||
63 | { |
||
64 | return $this->innerColumns; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @param array<non-empty-string> $columns |
||
0 ignored issues
–
show
|
|||
69 | */ |
||
70 | public function setOuterColumns(array $columns): self |
||
71 | { |
||
72 | $this->outerColumns = $columns; |
||
73 | |||
74 | return $this; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @return array<non-empty-string> |
||
0 ignored issues
–
show
|
|||
79 | */ |
||
80 | public function getOuterColumns(): array |
||
81 | { |
||
82 | return $this->outerColumns; |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Create an index on innerKey. |
||
87 | */ |
||
88 | public function createIndex(bool $createIndex = true): self |
||
89 | { |
||
90 | $this->createIndex = $createIndex; |
||
91 | |||
92 | return $this; |
||
93 | } |
||
94 | |||
95 | public function isCreateIndex(): bool |
||
96 | { |
||
97 | return $this->createIndex; |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * @param non-empty-string $action |
||
0 ignored issues
–
show
|
|||
102 | */ |
||
103 | public function setAction(string $action): self |
||
104 | { |
||
105 | $this->action = $action; |
||
106 | |||
107 | return $this; |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | * @return non-empty-string |
||
0 ignored issues
–
show
|
|||
112 | */ |
||
113 | public function getAction(): string |
||
114 | { |
||
115 | return $this->action; |
||
116 | } |
||
117 | } |
||
118 |