diff --git a/.gitignore b/.gitignore index 5408cab..b3aec00 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/ vendor/ .DS_Store +composer.lock diff --git a/NotificationsBundle/Service/NotificationsService.php b/NotificationsBundle/Service/NotificationsService.php index ddebc20..f1105da 100644 --- a/NotificationsBundle/Service/NotificationsService.php +++ b/NotificationsBundle/Service/NotificationsService.php @@ -51,8 +51,8 @@ class NotificationsService } /** - * Little shortcut to get all notification for a user - * This way you don't need to have a mnager or import notification. + * Little shortcut to get all of a user's notifications + * This way you don't need to have a manager or import the Notification class. * * If you want the return value to be associative arrays, set assoc to true * diff --git a/README.md b/README.md index 1ffe78c..330f8dc 100644 --- a/README.md +++ b/README.md @@ -64,4 +64,27 @@ Méthdodes: ## Entités -* Notification: représente une notification pour un seul utilisateur \ No newline at end of file +* Notification: représente une notification pour un seul utilisateur + +## Exemple + +Exemple pour notifier des users: + +```php +$notif = new Notification(); +$notif->setTitle("Bonjour"); +$notif->setDescription("Skippy vous attend dans son antre"); +$notif->setData("le_nom_de_la_route_en_react"); + +$users = [$user]; // Peut contenir plein d'users +$notifssrv->notifyUsers($users, $notif); +``` +Pas besoin de persist la notification créée, le service se charge de perist tous les clones +créés pour chacun des users. + + +Les notifications devront être retouvées côté client avec le endpoint `/get`, qui n'est +qu'une interface pour: +```php +$notifssrv->getForUser($this->getUser()); +``` \ No newline at end of file diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 82a25c5..0000000 --- a/composer.lock +++ /dev/null @@ -1,19 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "71470e0f0c2bb3d0849e24978e4ee684", - "packages": [], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=7.1" - }, - "platform-dev": [] -}