diff --git a/src/Entity/Post.php b/src/Entity/Post.php index 615251b..7f8446b 100644 --- a/src/Entity/Post.php +++ b/src/Entity/Post.php @@ -40,7 +40,7 @@ class Post /** * @var Collection */ - #[ORM\OneToMany(targetEntity: Commentary::class, mappedBy: 'post')] + #[ORM\OneToMany(targetEntity: Commentary::class, mappedBy: 'post', cascade: ['persist', 'remove'])] private Collection $commentaries; /** diff --git a/src/Entity/Profil.php b/src/Entity/Profil.php index 4637abb..edf42b8 100644 --- a/src/Entity/Profil.php +++ b/src/Entity/Profil.php @@ -34,13 +34,13 @@ class Profil implements UserInterface, PasswordAuthenticatedUserInterface /** * @var Collection */ - #[ORM\OneToMany(targetEntity: Post::class, mappedBy: 'profil')] + #[ORM\OneToMany(targetEntity: Post::class, mappedBy: 'profil', cascade: ['remove'])] private Collection $posts; /** * @var Collection */ - #[ORM\OneToMany(targetEntity: Commentary::class, mappedBy: 'profil')] + #[ORM\OneToMany(targetEntity: Commentary::class, mappedBy: 'profil', cascade: ['remove'])] private Collection $commentaries; /** diff --git a/var/data.db b/var/data.db index a20c961..e12a781 100644 Binary files a/var/data.db and b/var/data.db differ