cycle /
annotated
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Cycle\Annotated\Annotation\Inheritance; |
||
| 6 | |||
| 7 | use Cycle\Annotated\Annotation\Inheritance; |
||
| 8 | use JetBrains\PhpStorm\ExpectedValues; |
||
| 9 | use Spiral\Attributes\NamedArgumentConstructor; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @Annotation |
||
| 13 | * @NamedArgumentConstructor |
||
| 14 | * @Target("CLASS") |
||
| 15 | */ |
||
| 16 | #[\Attribute(\Attribute::TARGET_CLASS), NamedArgumentConstructor] |
||
| 17 | class JoinedTable extends Inheritance |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @param non-empty-string|null $outerKey Outer (parent) key name. |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 21 | * @param bool $fkCreate Set to true to automatically create FK on outerKey. |
||
| 22 | * @param non-empty-string|null $fkAction FK onDelete and onUpdate action. |
||
| 23 | */ |
||
| 24 | 144 | public function __construct( |
|
| 25 | private ?string $outerKey = null, |
||
| 26 | private bool $fkCreate = true, |
||
| 27 | /** |
||
| 28 | * @Enum({"NO ACTION", "CASCADE", "SET NULL"}) |
||
| 29 | */ |
||
| 30 | #[ExpectedValues(values: ['NO ACTION', 'CASCADE', 'SET NULL'])] |
||
| 31 | private ?string $fkAction = 'CASCADE', |
||
| 32 | ) { |
||
| 33 | 144 | parent::__construct('joined'); |
|
| 34 | 144 | } |
|
| 35 | |||
| 36 | 144 | public function getOuterKey(): ?string |
|
| 37 | { |
||
| 38 | 144 | return $this->outerKey; |
|
| 39 | } |
||
| 40 | |||
| 41 | 144 | public function isCreateFk(): bool |
|
| 42 | { |
||
| 43 | 144 | return $this->fkCreate; |
|
| 44 | } |
||
| 45 | |||
| 46 | 96 | public function getFkAction(): string |
|
| 47 | { |
||
| 48 | 96 | return $this->fkAction; |
|
|
0 ignored issues
–
show
|
|||
| 49 | } |
||
| 50 | } |
||
| 51 |