maximilienGilet / notification-bundle

A simple Symfony bundle to notify user
https://packagist.org/packages/mgilet/notification-bundle
MIT License
107 stars 58 forks source link

Useful commands #49

Open GGGGino opened 6 years ago

GGGGino commented 6 years ago

Hello,

what about to create some commands to accomplish common useful actions? For example:

php bin/console mgilet:notification:clear_notification For development purpose i had to clear notification tables several times.

If interested I already have the code

LeandroLuccerini commented 6 years ago

Hello, i'm working on a NotificationController#removeNotificationAction maybe tomorrow i will send a PR so if you want you can first check it, i also wanted to integrate also commands like you proposed. I was thinking of a set of commands like

  1. mgilet:notification:remove_notification : (clear_notification in your case) deletes all the notifications and all the NotifiableNotifications
  2. mgilet:notification:remove_notification --notifiable=[id]: deletes all notification (NotifiableNotification) for given Notifiable Entity
  3. mgilet:notification:remove_notification --older_than=[time]: deletes all the notifications older than given time such, for example: 3m or 10d or 2y or 1w (where m=months, d=days, y=years and w=weeks) and combinations

Obviuosly the command can combine all the options.

Setting something like a cron, this could be useful to avoid uncontrolled growth of the tables.

If you will find my PR useful (and @maximilienGilet agrees) you can fork and work on it.

GGGGino commented 6 years ago

Ok,

i agree on all the points. I'll wait @maximilienGilet response and i'll start working on it.

Thanks

maximilienGilet commented 6 years ago

Hi !

This is a great idea that could be very useful ! I don't have much time so a pull request would be nice.

Thanks for the interest in this bundle 👍