creavo/notify-task-bundle

此包已被废弃,不再维护。未建议替代包。

用于管理任务和通知的包

安装次数: 3,167

依赖项: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

0.3.11 2024-05-01 10:03 UTC

README

SensioLabsInsight Packagist

安装

composer require creavo/notify-task-bundle

使用以下方法将包添加到您的 app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            [...],
            new Creavo\NotifyTaskBundle\CreavoNotifyTaskBundle(),
        ];
        
        return $bundles;
    }
    
    [...]
}

routing.yml 中注册路由

notify_task:
    resource: '@CreavoNotifyTaskBundle/Resources/config/routing.xml'
    prefix: /task-notify

更新 doctrine-schema - 使用

php bin/console doctrine:schema:update

或进行迁移

php bin/console doctrine:migration:diff
php bin/console doctrine:migration:migrate

配置

将配置添加到您的 config.yml 并根据您的需求进行调整

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

使用方法

创建通知

// 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();

待办事项

  • 只创建一个未读通知 - 系统必须检查该通知是否已存在,并可能拒绝第二个通知