diff --git a/src/Entity/Mail.php b/src/Entity/Mail.php index 2986d24..4761d22 100644 --- a/src/Entity/Mail.php +++ b/src/Entity/Mail.php @@ -2,8 +2,8 @@ namespace App\Entity; -use App\Repository\MailRepository; use App\Doctrine\Timestampable; +use App\Repository\MailRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -25,8 +25,8 @@ class Mail private $id; /** - * @ORM\ManyToOne(targetEntity=Mailing::class, inversedBy="mails") - * @ORM\JoinColumn(nullable=false) + * @ORM\ManyToOne(targetEntity=Mailing::class, inversedBy="mails", cascade={"all"}) + * @ORM\JoinColumn(nullable=false, onDelete="CASCADE") */ private $mailing; @@ -51,7 +51,7 @@ class Mail private $textContent; /** - * @ORM\OneToMany(targetEntity=MailAttachment::class, mappedBy="mail", orphanRemoval=true) + * @ORM\OneToMany(targetEntity=MailAttachment::class, mappedBy="mail", orphanRemoval=true, cascade={"all"}) */ private $mailAttachments; diff --git a/src/Entity/MailAttachment.php b/src/Entity/MailAttachment.php index 4554919..452dafd 100644 --- a/src/Entity/MailAttachment.php +++ b/src/Entity/MailAttachment.php @@ -18,8 +18,8 @@ class MailAttachment private $id; /** - * @ORM\ManyToOne(targetEntity=Mail::class, inversedBy="mailAttachments") - * @ORM\JoinColumn(nullable=false) + * @ORM\ManyToOne(targetEntity=Mail::class, inversedBy="mailAttachments", cascade={"all"}) + * @ORM\JoinColumn(nullable=false, onDelete="CASCADE") */ private $mail; diff --git a/src/Entity/Mailing.php b/src/Entity/Mailing.php index d695559..6678c20 100644 --- a/src/Entity/Mailing.php +++ b/src/Entity/Mailing.php @@ -31,7 +31,7 @@ class Mailing private $label; /** - * @ORM\OneToMany(targetEntity=Mail::class, mappedBy="mailing", orphanRemoval=true) + * @ORM\OneToMany(targetEntity=Mail::class, mappedBy="mailing", orphanRemoval=true, cascade={"all"}) */ private $mails;