@@ -258,6 +258,7 @@ use Cycle\Annotated\Annotation\Column;
258
258
use Cycle\Annotated\Annotation\Entity;
259
259
use Cycle\Annotated\Annotation\Relation\BelongsTo;
260
260
use Cycle\Annotated\Annotation\Relation\HasMany;
261
+ use Ramsey\Uuid\Uuid;
261
262
262
263
#[Entity(repository: PostRepository::class)]
263
264
class Post
@@ -284,7 +285,7 @@ class Post
284
285
$this->content = $content;
285
286
$this->user = $user;
286
287
287
- $this->comments = new Collection()
288
+ $this->comments = new Collection();
288
289
}
289
290
290
291
public function id(): string
@@ -321,6 +322,11 @@ class Post
321
322
namespace Domain\Post\Comment;
322
323
323
324
use 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;
324
330
325
331
#[Entity(repository: CommentRepository::class)]
326
332
class Comment
@@ -332,6 +338,9 @@ class Comment
332
338
private string $content;
333
339
334
340
#[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)]
335
344
private ?User $user;
336
345
337
346
public function __construct(string $content, Post $post, ?User $user)
@@ -375,6 +384,7 @@ use Cycle\Annotated\Annotation\Entity;
375
384
use Cycle\Annotated\Annotation\Relation\HasMany;
376
385
use Domain\Post\Post;
377
386
use Illuminate\Support\Collection;
387
+ use Ramsey\Uuid\Uuid;
378
388
379
389
#[Entity(repository: UserRepository::class)]
380
390
class User
0 commit comments