diff options
author | Jonas Kohl | 2024-09-08 17:53:55 +0200 |
---|---|---|
committer | Jonas Kohl | 2024-09-08 17:53:55 +0200 |
commit | 415a0a96a76afbe7f1ad2f51862641793caf1b6c (patch) | |
tree | 1168316bff6a2ec04ee27db5ada5431ba6631ce4 /src/application/mystic/forum/attributes |
Initial commit
Diffstat (limited to 'src/application/mystic/forum/attributes')
5 files changed, 48 insertions, 0 deletions
diff --git a/src/application/mystic/forum/attributes/Column.php b/src/application/mystic/forum/attributes/Column.php new file mode 100644 index 0000000..aee47a2 --- /dev/null +++ b/src/application/mystic/forum/attributes/Column.php @@ -0,0 +1,11 @@ +<?php + +namespace mystic\forum\attributes; + +#[\Attribute(\Attribute::TARGET_PROPERTY)] +class Column { + public function __construct( + public readonly ?string $columnName = null, + public readonly ?string $columnType = null, + ) {} +} diff --git a/src/application/mystic/forum/attributes/NotNull.php b/src/application/mystic/forum/attributes/NotNull.php new file mode 100644 index 0000000..2c90da0 --- /dev/null +++ b/src/application/mystic/forum/attributes/NotNull.php @@ -0,0 +1,6 @@ +<?php + +namespace mystic\forum\attributes; + +#[\Attribute(\Attribute::TARGET_PROPERTY)] +class NotNull {} diff --git a/src/application/mystic/forum/attributes/PrimaryKey.php b/src/application/mystic/forum/attributes/PrimaryKey.php new file mode 100644 index 0000000..a8f0fc7 --- /dev/null +++ b/src/application/mystic/forum/attributes/PrimaryKey.php @@ -0,0 +1,6 @@ +<?php + +namespace mystic\forum\attributes; + +#[\Attribute(\Attribute::TARGET_PROPERTY)] +class PrimaryKey {} diff --git a/src/application/mystic/forum/attributes/References.php b/src/application/mystic/forum/attributes/References.php new file mode 100644 index 0000000..ac431ff --- /dev/null +++ b/src/application/mystic/forum/attributes/References.php @@ -0,0 +1,15 @@ +<?php + +namespace mystic\forum\attributes; + +#[\Attribute(\Attribute::TARGET_PROPERTY)] +class References { + public function __construct( + public readonly string $foreignTableName, + public readonly ?string $foreignColumnName = null, + ) {} + + public function __toString(): string { + return $this->foreignTableName . ($this->foreignColumnName !== null ? " ({$this->foreignColumnName})" : ""); + } +} diff --git a/src/application/mystic/forum/attributes/Table.php b/src/application/mystic/forum/attributes/Table.php new file mode 100644 index 0000000..60fe1ae --- /dev/null +++ b/src/application/mystic/forum/attributes/Table.php @@ -0,0 +1,10 @@ +<?php + +namespace mystic\forum\attributes; + +#[\Attribute(\Attribute::TARGET_CLASS)] +class Table { + public function __construct( + public readonly string $tableName, + ) {} +} |