diff options
Diffstat (limited to 'src/application/mystic/forum/orm')
-rw-r--r-- | src/application/mystic/forum/orm/Entity.php | 6 | ||||
-rw-r--r-- | src/application/mystic/forum/orm/Post.php | 17 | ||||
-rw-r--r-- | src/application/mystic/forum/orm/Topic.php | 15 | ||||
-rw-r--r-- | src/application/mystic/forum/orm/User.php | 17 |
4 files changed, 55 insertions, 0 deletions
diff --git a/src/application/mystic/forum/orm/Entity.php b/src/application/mystic/forum/orm/Entity.php new file mode 100644 index 0000000..9afc1b3 --- /dev/null +++ b/src/application/mystic/forum/orm/Entity.php @@ -0,0 +1,6 @@ +<?php +declare(strict_types=1); + +namespace mystic\forum\orm; + +abstract class Entity {} diff --git a/src/application/mystic/forum/orm/Post.php b/src/application/mystic/forum/orm/Post.php new file mode 100644 index 0000000..db297e5 --- /dev/null +++ b/src/application/mystic/forum/orm/Post.php @@ -0,0 +1,17 @@ +<?php +declare(strict_types=1); + +namespace mystic\forum\orm; + +use mystic\forum\attributes\PrimaryKey; +use mystic\forum\attributes\References; +use mystic\forum\attributes\Table; + +#[Table("public.posts")] +class Post extends Entity { + #[PrimaryKey] public string $id; + public string $content; + #[References("public.users")] public string $authorId; + public \DateTimeImmutable $postDate; + #[References("public.topics")] public string $topicId; +} diff --git a/src/application/mystic/forum/orm/Topic.php b/src/application/mystic/forum/orm/Topic.php new file mode 100644 index 0000000..202fc50 --- /dev/null +++ b/src/application/mystic/forum/orm/Topic.php @@ -0,0 +1,15 @@ +<?php +declare(strict_types=1); + +namespace mystic\forum\orm; + +use mystic\forum\attributes\PrimaryKey; +use mystic\forum\attributes\Table; + +#[Table("public.topics")] +class Topic extends Entity { + #[PrimaryKey] + public string $id; + public string $title; + public \DateTimeImmutable $creationDate; +} diff --git a/src/application/mystic/forum/orm/User.php b/src/application/mystic/forum/orm/User.php new file mode 100644 index 0000000..3b531b4 --- /dev/null +++ b/src/application/mystic/forum/orm/User.php @@ -0,0 +1,17 @@ +<?php +declare(strict_types=1); + +namespace mystic\forum\orm; + +use mystic\forum\attributes\PrimaryKey; +use mystic\forum\attributes\Table; + +#[Table("public.users")] +class User extends Entity { + #[PrimaryKey] + public string $id; + public string $name; + public string $displayName; + public \DateTimeImmutable $created; + public string $passwordHash; +} |