creavo / notify-task-bundle
A bundle to manage tasks and notifications
Installs: 3 168
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >5.5.9
README
Installation
composer require creavo/notify-task-bundle
Add the bundle to your app/AppKernel.php
with
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
[...],
new Creavo\NotifyTaskBundle\CreavoNotifyTaskBundle(),
];
return $bundles;
}
[...]
}
register routing in routing.yml
:
notify_task:
resource: '@CreavoNotifyTaskBundle/Resources/config/routing.xml'
prefix: /task-notify
Update the doctrine-schema - use
php bin/console doctrine:schema:update
or do a migration:
php bin/console doctrine:migration:diff
php bin/console doctrine:migration:migrate
configuration
add to your config.yml
and adjust to your wishes:
creavo_notify_task:
send_notification_immediately: true
pushover_enabled: false
pushover_api_token: YOUR_PUSHOVER_APP_TOKEN
email_enabled: false
email_from: symfony@localhost
email_subject: new notification
usage
create notification:
// create notification
$notification=$this->get('creavo_notify_task.notification')->create($user, 'this is the message', 'optional title', $relatedEntity);
// maybe modify notification further
$notification->setLinkTitle('Test');
// save it
$this->get('creavo_notify_task.notification')->save($nofitication);
// you can also save it with $em directly, but this will not trigger pushover or email-notification
$em->persist($notification);
$em->flush();
todo
- create only one unread notification - system must check, if it already exists and maybe reject the second notification