ulmus/src/Attribute/Property/Field/ForeignKey.php

25 lines
739 B
PHP

<?php
namespace Ulmus\Attribute\Property\Field;
/**
* Since we need consistancy between the declaration of our ID and FK fields, it
* was decided to extend the PK class instead of Field for this case.
*/
#[\Attribute(\Attribute::TARGET_PROPERTY)]
class ForeignKey extends PrimaryKey {
public function __construct(
public ? string $name = null,
public ? string $type = 'bigint',
public null|int|string $length = null,
public ? int $precision = null,
public array $attributes = [
'primary_key' => false,
'auto_increment' => false
],
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
) {}
}