- WIP on relations, constrains and foreign keys
This commit is contained in:
1 parent
01ab6e82d4
commit
d01624b8aa
8 files changed
+90
-30
No files matched your search
@@ -3,6 +3,7 @@
|
||||
namespace Ulmus\Attribute\Property\Field;
|
||||
|
||||
use Ulmus\Attribute\Attribute;
|
||||
use Ulmus\Attribute\ConstrainActionEnum;
|
||||
|
||||
/**
|
||||
* Since we need consistancy between the declaration of our ID and FK fields, it
|
||||
@@ -10,17 +11,6 @@ use Ulmus\Attribute\Attribute;
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class ForeignKey extends PrimaryKey {
|
||||
|
||||
public const SET_NULL = "null";
|
||||
|
||||
public const SET_DEFAULT = "default";
|
||||
|
||||
public const RESTRICT = "restrict";
|
||||
|
||||
public const NO_ACTION = "noaction";
|
||||
|
||||
public const CASCADE = "cascade";
|
||||
|
||||
public function __construct(
|
||||
public ? string $name = null,
|
||||
public ? string $type = 'bigint',
|
||||
@@ -33,11 +23,10 @@ class ForeignKey extends PrimaryKey {
|
||||
public bool $nullable = false,
|
||||
public mixed $default = null,
|
||||
public bool $readonly = false,
|
||||
public null|array|string|\Stringable $foreignKey = "",
|
||||
public null|array|string|\Stringable $references = null,
|
||||
public null|string $onDelete = self::NO_ACTION,
|
||||
public null|string $onUpdate = self::NO_ACTION,
|
||||
public null|string $relation = null,
|
||||
public ConstrainActionEnum $onDelete = ConstrainActionEnum::NoAction,
|
||||
public ConstrainActionEnum $onUpdate = ConstrainActionEnum::NoAction,
|
||||
) {
|
||||
$this->references = Attribute::handleArrayField($this->references, false);
|
||||
#$this->references = Attribute::handleArrayField($this->references, false);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user