Skip to content

Commit 159d49a

Browse files
bastien70jmsche
authored andcommitted
Using cascade database level
1 parent 0f99bf9 commit 159d49a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Entity/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Database implements \Stringable
4444
private ?\DateTimeInterface $createdAt;
4545

4646
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'databases')]
47-
#[ORM\JoinColumn(nullable: false)]
47+
#[ORM\JoinColumn(nullable: false, onDelete: 'cascade')]
4848
private User $owner;
4949

5050
public function __construct()

src/Entity/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, \String
3535

3636
private ?string $plainPassword = null;
3737

38-
#[ORM\OneToMany(mappedBy: 'owner', targetEntity: Database::class, cascade: ['remove'], orphanRemoval: true)]
38+
#[ORM\OneToMany(mappedBy: 'owner', targetEntity: Database::class, orphanRemoval: true)]
3939
private Collection $databases;
4040

4141
public function __construct()

0 commit comments

Comments
 (0)