Browse Source

add cascade

develop
Simon Vieille 1 week ago
parent
commit
a5eaec3544
Signed by: deblan GPG Key ID: 03383D15A1D31745
3 changed files with 7 additions and 7 deletions
  1. +4
    -4
      src/Entity/Mail.php
  2. +2
    -2
      src/Entity/MailAttachment.php
  3. +1
    -1
      src/Entity/Mailing.php

+ 4
- 4
src/Entity/Mail.php 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;

+ 2
- 2
src/Entity/MailAttachment.php 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;

+ 1
- 1
src/Entity/Mailing.php 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;

Loading…
Cancel
Save