From 086e2d2668784469ec114f6e6fd2b3dace3d7c3b Mon Sep 17 00:00:00 2001 From: Jonas Kohl Date: Thu, 12 Sep 2024 19:49:17 +0200 Subject: Way more progress on forum --- src/application/mystic/forum/orm/Post.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/application/mystic/forum/orm/Post.php') diff --git a/src/application/mystic/forum/orm/Post.php b/src/application/mystic/forum/orm/Post.php index 2c9a38c..becbb9d 100644 --- a/src/application/mystic/forum/orm/Post.php +++ b/src/application/mystic/forum/orm/Post.php @@ -3,6 +3,7 @@ declare(strict_types=1); namespace mystic\forum\orm; +use mystic\forum\attributes\DefaultValue; use mystic\forum\attributes\PrimaryKey; use mystic\forum\attributes\References; use mystic\forum\attributes\Table; @@ -11,7 +12,8 @@ use mystic\forum\attributes\Table; class Post extends Entity { #[PrimaryKey] public string $id; public string $content; - #[References("public.users")] public string $authorId; + #[References("public.users", onDelete: References::SET_NULL)] public ?string $authorId; public \DateTimeImmutable $postDate; - #[References("public.topics", cascadeOnDelete: true)] public string $topicId; + #[References("public.topics", onDelete: References::CASCADE)] public string $topicId; + #[DefaultValue("false")] public bool $deleted; } -- cgit v1.2.3