Total Complexity | 4 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class ForeignKey |
||
8 | { |
||
9 | protected array $innerKeys = []; |
||
10 | protected string $outerTable; |
||
11 | protected array $outerKeys = []; |
||
12 | protected FKAction $onDelete; |
||
13 | protected FKAction $onUpdate; |
||
14 | protected ?string $name = null; |
||
15 | |||
16 | public function __construct(array $innerKey, string $table, array $outerKey) |
||
17 | { |
||
18 | $this->innerKeys = $innerKey; |
||
19 | $this->outerTable = $table; |
||
20 | $this->outerKeys = $outerKey; |
||
21 | |||
22 | $this->onDelete = FKAction::cascade(); |
||
23 | $this->onUpdate = FKAction::cascade(); |
||
24 | } |
||
25 | |||
26 | public function name(?string $name): self |
||
27 | { |
||
28 | $this->name = $name; |
||
29 | |||
30 | return $this; |
||
31 | } |
||
32 | |||
33 | public function onDelete(FKAction $action): self |
||
34 | { |
||
35 | $this->onDelete = $action; |
||
36 | |||
37 | return $this; |
||
38 | } |
||
39 | |||
40 | public function onUpdate(FKAction $action): self |
||
45 | } |
||
46 | } |
||
47 |