Total Complexity | 2 |
Total Lines | 15 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
32 | final readonly class UniqueIndex implements ComponentInterface |
||
|
|||
33 | { |
||
34 | /** |
||
35 | * @param array<array-key,string> $columns |
||
36 | */ |
||
37 | public function __construct(private array $columns) |
||
38 | { |
||
39 | } |
||
40 | |||
41 | public function toDBAL(string $table): DBALIndex |
||
42 | { |
||
43 | return new DBALIndex( |
||
44 | name: DB::prefix(implode('_', ['ux', $table, ...$this->columns])), |
||
45 | columns: $this->columns, |
||
46 | isUnique: true |
||
47 | ); |
||
50 |