Namespace and ClassPath rewrites
This commit is contained in:
21
Core/Objects/DatabaseEntity/Attribute/DefaultValue.class.php
Normal file
21
Core/Objects/DatabaseEntity/Attribute/DefaultValue.class.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Objects\DatabaseEntity\Attribute;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)] class DefaultValue {
|
||||
|
||||
private mixed $value;
|
||||
|
||||
public function __construct(mixed $value) {
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getValue() {
|
||||
if (is_string($this->value) && isClass($this->value)) {
|
||||
return new $this->value();
|
||||
}
|
||||
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
17
Core/Objects/DatabaseEntity/Attribute/Enum.class.php
Normal file
17
Core/Objects/DatabaseEntity/Attribute/Enum.class.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Objects\DatabaseEntity\Attribute;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)] class Enum {
|
||||
|
||||
private array $values;
|
||||
|
||||
public function __construct(string ...$values) {
|
||||
$this->values = $values;
|
||||
}
|
||||
|
||||
public function getValues(): array {
|
||||
return $this->values;
|
||||
}
|
||||
|
||||
}
|
||||
7
Core/Objects/DatabaseEntity/Attribute/Json.class.php
Normal file
7
Core/Objects/DatabaseEntity/Attribute/Json.class.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Objects\DatabaseEntity\Attribute;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)] class Json {
|
||||
|
||||
}
|
||||
16
Core/Objects/DatabaseEntity/Attribute/Many.class.php
Normal file
16
Core/Objects/DatabaseEntity/Attribute/Many.class.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Objects\DatabaseEntity\Attribute;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)] class Many {
|
||||
|
||||
private string $type;
|
||||
|
||||
public function __construct(string $type) {
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function getValue(): string {
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
15
Core/Objects/DatabaseEntity/Attribute/MaxLength.class.php
Normal file
15
Core/Objects/DatabaseEntity/Attribute/MaxLength.class.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Objects\DatabaseEntity\Attribute;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)] class MaxLength {
|
||||
private int $maxLength;
|
||||
|
||||
function __construct(int $maxLength) {
|
||||
$this->maxLength = $maxLength;
|
||||
}
|
||||
|
||||
public function getValue(): int {
|
||||
return $this->maxLength;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Objects\DatabaseEntity\Attribute;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)] class Transient {
|
||||
|
||||
}
|
||||
7
Core/Objects/DatabaseEntity/Attribute/Unique.class.php
Normal file
7
Core/Objects/DatabaseEntity/Attribute/Unique.class.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Objects\DatabaseEntity\Attribute;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)] class Unique {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user