私はコメントをREGISTRATION_COMPLETED
ライン、方法FOS FlashListener::getSubscribedEvents()
をオーバーロードしたいと思います:FOSUserBundle FlashListener REGISTRATION_COMPLETEDメッセージを削除
// vendor/friendsofsymfony/user-bundle/EventListener/FlashListener.php
public static function getSubscribedEvents() {
return array(
FOSUserEvents::CHANGE_PASSWORD_COMPLETED => 'addSuccessFlash',
FOSUserEvents::GROUP_CREATE_COMPLETED => 'addSuccessFlash',
FOSUserEvents::GROUP_DELETE_COMPLETED => 'addSuccessFlash',
FOSUserEvents::GROUP_EDIT_COMPLETED => 'addSuccessFlash',
FOSUserEvents::PROFILE_EDIT_COMPLETED => 'addSuccessFlash',
FOSUserEvents::REGISTRATION_COMPLETED => 'addSuccessFlash',
FOSUserEvents::RESETTING_RESET_COMPLETED => 'addSuccessFlash',
);
}
数に関する情報があります:
// vendor/friendsofsymfony/user-bundle/Resources/config/flash_notifications.xml
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="fos_user.listener.flash" class="FOS\UserBundle\EventListener\FlashListener">
<tag name="kernel.event_subscriber" />
<argument type="service" id="session" />
<argument type="service" id="translator" />
</service>
</services>
</container>
私はそれを行っています。
<?php
// src/XXXX/UserBundle/EventListener/FlashListener.php
namespace XXXX\UserBundle\EventListener;
use FOS\UserBundle\EventListener\FlashListener AS BaseListener;
use FOS\UserBundle\FOSUserEvents;
class FlashListener extends BaseListener {
public static function getSubscribedEvents() {
return [
FOSUserEvents::CHANGE_PASSWORD_COMPLETED => 'addSuccessFlash',
FOSUserEvents::GROUP_CREATE_COMPLETED => 'addSuccessFlash',
FOSUserEvents::GROUP_DELETE_COMPLETED => 'addSuccessFlash',
FOSUserEvents::GROUP_EDIT_COMPLETED => 'addSuccessFlash',
FOSUserEvents::PROFILE_EDIT_COMPLETED => 'addSuccessFlash',
// FOSUserEvents::REGISTRATION_COMPLETED => 'addSuccessFlash',
FOSUserEvents::RESETTING_RESET_COMPLETED => 'addSuccessFlash',
];
}
}
およびその値:
#src/XXXX/XXXXXBundle/Resources/config/services.yml
services:
fos_user.listener.flash:
class: XXXX\UserBundle\EventListener\FlashListener
arguments: ['@session','@translator']
tags:
- { name: kernel.event_subscriber }
しかし、私はまだサブスクリプションの後にメッセージを持っています。
誰かが私を助けてくれますか?