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/orm |
Initial commit
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; +} |