brandcodenl/symfony-notification-bundle

一个简单的通知包

v0.1-beta 2019-06-14 09:23 UTC

This package is auto-updated.

Last update: 2024-09-15 12:34:29 UTC


README

此包提供了一些默认资源,用于管理和显示(与用户关联的)Facebook 类型的通知。

配置此包

  1. 创建自己的通知实体,并在此包中扩展通知实体。
<?php
namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use BrandcodeNL\SymfonyNotificationBundle\Entity\Notification as BaseNotification;

class Notification extends BaseNotification
{
}

要将通知链接到您的用户实体,请在您的实体中实现 BrandcodeNL\SymfonyNotificationBundle\Model\UserInterface。之后,将以下配置行添加到您的 config.yml/doctrine.yml 文件中。

doctrine:
    orm: 
        resolve_target_entities:
            BrandcodeNL\SymfonyNotificationBundle\Model\UserInterface: Path\To\Your\Entity

此包包含一些默认路由,用于将通知设置为“已读”状态。要使用这些路由,您必须将它们包含在 routes.yml 文件中。

brandcodenl_symfony_notification_bundle_routing:
    resource: "@BrandcodeNLNotificationBundle/Controller"
    prefix: /
    type: annotation

如果您想使用此包提供的任何默认视图,可以将它们包含在您的视图中。

 {% include '@BrandcodeNLNotification/NotificationContainer.html.twig' %}