summaryrefslogtreecommitdiff
path: root/src/application/mystic/forum/attributes
diff options
context:
space:
mode:
Diffstat (limited to 'src/application/mystic/forum/attributes')
-rw-r--r--src/application/mystic/forum/attributes/Column.php11
-rw-r--r--src/application/mystic/forum/attributes/NotNull.php6
-rw-r--r--src/application/mystic/forum/attributes/PrimaryKey.php6
-rw-r--r--src/application/mystic/forum/attributes/References.php15
-rw-r--r--src/application/mystic/forum/attributes/Table.php10
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,
+ ) {}
+}