Skip to content

Commit

Permalink
Remove some cascade removes (#1445)
Browse files Browse the repository at this point in the history
  • Loading branch information
BentiGorlich authored Feb 9, 2025
1 parent af62c08 commit 95338ff
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Entity/MessageThread.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MessageThread
new JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE'),
]
)]
#[ManyToMany(targetEntity: User::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ManyToMany(targetEntity: User::class, cascade: ['persist'], orphanRemoval: true)]
public Collection $participants;
#[OneToMany(mappedBy: 'thread', targetEntity: Message::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
#[OrderBy(['createdAt' => 'ASC'])]
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/NewSignupNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#[Entity]
class NewSignupNotification extends Notification
{
#[ManyToOne(targetEntity: User::class, cascade: ['remove'])]
#[ManyToOne(targetEntity: User::class)]
#[JoinColumn(nullable: true, onDelete: 'CASCADE')]
public ?User $newUser;

Expand Down
10 changes: 5 additions & 5 deletions src/Entity/NotificationSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ class NotificationSettings
#[Id, GeneratedValue, Column(type: 'integer')]
private int $id;

#[ManyToOne(targetEntity: User::class, cascade: ['remove'])]
#[ManyToOne(targetEntity: User::class)]
#[JoinColumn(nullable: false, onDelete: 'CASCADE')]
public User $user;

#[ManyToOne(targetEntity: Entry::class, cascade: ['remove'])]
#[ManyToOne(targetEntity: Entry::class)]
#[JoinColumn(nullable: true, onDelete: 'CASCADE')]
public ?Entry $entry = null;

#[ManyToOne(targetEntity: Post::class, cascade: ['remove'])]
#[ManyToOne(targetEntity: Post::class)]
#[JoinColumn(nullable: true, onDelete: 'CASCADE')]
public ?Post $post = null;

#[ManyToOne(targetEntity: Magazine::class, cascade: ['remove'])]
#[ManyToOne(targetEntity: Magazine::class)]
#[JoinColumn(nullable: true, onDelete: 'CASCADE')]
public ?Magazine $magazine = null;

#[ManyToOne(targetEntity: User::class, cascade: ['remove'])]
#[ManyToOne(targetEntity: User::class)]
#[JoinColumn(nullable: true, onDelete: 'CASCADE')]
public ?User $targetUser = null;

Expand Down
4 changes: 2 additions & 2 deletions src/Entity/UserPushSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class UserPushSubscription
#[Id, GeneratedValue, Column(type: 'integer')]
public int $id;

#[ManyToOne(targetEntity: User::class, cascade: ['persist', 'remove'], inversedBy: 'pushSubscriptions')]
#[ManyToOne(targetEntity: User::class, cascade: ['persist'], inversedBy: 'pushSubscriptions')]
public User $user;

#[Column(type: 'text')]
Expand All @@ -30,7 +30,7 @@ class UserPushSubscription
/**
* @var AccessToken|null this is only null for the web interface push messages
*/
#[ManyToOne(targetEntity: AccessToken::class, cascade: ['persist', 'remove'])]
#[ManyToOne(targetEntity: AccessToken::class, cascade: ['persist'])]
#[JoinColumn(name: 'api_token', referencedColumnName: 'identifier', unique: true, nullable: true, onDelete: 'CASCADE')]
public ?AccessToken $apiToken = null;

Expand Down

0 comments on commit 95338ff

Please sign in to comment.