- Some small bugfixes made
This commit is contained in:
1 parent
a4743b471c
commit
01ab6e82d4
6 files changed
+55
-8
No files matched your search
@@ -10,6 +10,17 @@ 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',
|
||||
@@ -22,8 +33,11 @@ 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,
|
||||
) {
|
||||
$this->references = Attribute::handleArrayField($this->references);
|
||||
$this->references = Attribute::handleArrayField($this->references, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Attribute\Property;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Index {
|
||||
|
||||
public const TYPE_PRIMARY = 'primary';
|
||||
|
||||
public const TYPE_INDEX = 'index';
|
||||
|
||||
public const TYPE_UNIQUE = 'unique';
|
||||
|
||||
public const TYPE_SPATIAL = 'spatial';
|
||||
|
||||
public const TYPE_FULLTEXT = 'fulltext';
|
||||
|
||||
public function __construct(
|
||||
public string $type = self::TYPE_INDEX,
|
||||
) {}
|
||||
}
|
||||
Reference in new issue
Block a user