add cascade

This commit is contained in:
Simon Vieille 2020-11-15 14:47:18 +01:00
parent 7c1c2a7233
commit a5eaec3544
Signed by: deblan
GPG Key ID: 03383D15A1D31745
3 changed files with 7 additions and 7 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;