@@ -258,6 +258,7 @@ use Cycle\Annotated\Annotation\Column;
258258use Cycle\Annotated\Annotation\Entity;
259259use Cycle\Annotated\Annotation\Relation\BelongsTo;
260260use Cycle\Annotated\Annotation\Relation\HasMany;
261+ use Ramsey\Uuid\Uuid;
261262
262263#[Entity(repository: PostRepository::class)]
263264class Post
@@ -284,7 +285,7 @@ class Post
284285 $this->content = $content;
285286 $this->user = $user;
286287
287- $this->comments = new Collection()
288+ $this->comments = new Collection();
288289 }
289290
290291 public function id(): string
@@ -321,6 +322,11 @@ class Post
321322namespace Domain\Post\Comment;
322323
323324use Domain\User\User;
325+ use Cycle\Annotated\Annotation\Column;
326+ use Cycle\Annotated\Annotation\Entity;
327+ use Cycle\Annotated\Annotation\Relation\BelongsTo;
328+ use Domain\User\User;
329+ use Ramsey\Uuid\Uuid;
324330
325331#[Entity(repository: CommentRepository::class)]
326332class Comment
@@ -332,6 +338,9 @@ class Comment
332338 private string $content;
333339
334340 #[BelongsTo(target: Post::class, innerKey: 'post_id', outerKey: 'id', nullable: false)]
341+ private ?Post $post;
342+
343+ #[BelongsTo(target: User::class, innerKey: 'user_id', outerKey: 'id', nullable: false)]
335344 private ?User $user;
336345
337346 public function __construct(string $content, Post $post, ?User $user)
@@ -375,6 +384,7 @@ use Cycle\Annotated\Annotation\Entity;
375384use Cycle\Annotated\Annotation\Relation\HasMany;
376385use Domain\Post\Post;
377386use Illuminate\Support\Collection;
387+ use Ramsey\Uuid\Uuid;
378388
379389#[Entity(repository: UserRepository::class)]
380390class User
0 commit comments