blob: 9e33927006b24ca61adb89340717980898b7067d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<?php
namespace mystic\forum\attributes;
#[\Attribute(\Attribute::TARGET_PROPERTY)]
class References {
public function __construct(
public readonly string $foreignTableName,
public readonly ?string $foreignColumnName = null,
public readonly bool $cascadeOnDelete = false,
) {}
public function __toString(): string {
return $this->foreignTableName
. ($this->foreignColumnName !== null ? " ({$this->foreignColumnName})" : "")
. ($this->cascadeOnDelete ? " ON DELETE CASCADE" : "");
}
}
|