notification-bundle
notification-bundle copied to clipboard
Adding removeNotificationAction to NotificationController
This PR is about removing Notifications from Notifiable point of view.
Let's think about a User (that is a Notifiable
) point of view. It can be able to delete his own notifications.
What i have done
As you can see in commits descriptions
- Added a database level "ON DELETE CASCADE" behaviour to NotifibiableNotification. This means that if a notification is deleted all the links between it and a Notifiable are deleted too. It was realized by ON DELETE and not by doctrine persist clause just for performances.
- Added
NotificationController#removeNotificationAction
to handle deletion of a NotifiableNotification. Added also the generation of "notification_remove" route into Twig\NotificationExtension - Added UniqueConstraint to NotifiableNotification on columns notifiable_entity_id and notification_id to assure no duplicates of the same notification for a Notifiable
- Updated
NotificationManager#removeNotification
, now removes also Notification without any link in NotifiableNotification to keep the database clean. I've also removed the flush parameter as no flush is requested to execute the query.
BC breaks
Accepting this PR means update the database schema by php bin\console doctrine:schema:update --dump-sql --force
and remove $flush
parameter when using NotificationManager#removeNotification
Let me know what you think. Thanks
Any news on this PR?
:+1: