jjzjj

listener

全部标签

php - FOSRestBundle 捕获所有路由

我正在尝试将FOSRestBundle集成到我的应用程序中。我只想在路由匹配时使用它,如^/api。我真的不知道如何使用这个包,而且我认为文档非常糟糕。(无意冒犯)。fos_rest:format_listener:enabled:truerules:-{path:'^/api',priorities:['json','xml'],fallback_format:'html'}当我从我的浏览器请求任何路由时,我得到这个错误:NomatchingacceptedResponseformatcouldbedetermined我只想匹配以^/api开头的路由。有什么想法吗?

php - laravel 模型 $events 没有被触发

我正在创建一个新应用程序,当创建文章时,将在其上显示通知。我尝试过使用事件和监听器。我的App\Article.php...protected$events=['created'=>Events\ArticleWasPublished::class];...我的App\Providers\EventServiceProvider.phpprotected$listen=['App\Events\ArticleWasPublished'=>['App\Listeners\NotifyUsers',],];我的App\Events\ArticleWasPublished.php...use

php - Symfony2 事件监听器作为服务

当将事件监听器定义为服务时,我该如何定义哪个函数与哪个事件一起使用?服务.yml:kernel.listener.desktop_init:class:AirOS\TopBarModule\Listeners\InitAdminDesktopListenertags:-{name:kernel.listener}监听类:classInitAdminDesktopListener{publicfunctiononInitAdminDesktop(InitAdminDesktopEvent$event){$session=$event->getSession();$session->set

php - 学说 : Symfony2 Listener vs inclass Lifecycle callbacks

我一直在处理一个图像实体,当持久化时,它使用内部方法来保存/移动/删除使用钩子(Hook)注释关联的图像文件,但我觉得有点像实体本身应该只是相关的getter和setter。我应该将方法保留在实体中还是将它们移至监听器类?实体有方法:生成唯一的文件名/路径将图像文件持久保存到磁盘在级联移除时移除图像。但我不确定我是否喜欢这个存在于我的实体中../***@ORM\PostPersist()*@ORM\PostUpdate()*/publicfunctionupload(){if(null===$this->getFile()){return;}//throwsexceptiononerr

php - ZF2 : How to attach module specific listener for dispatch. 错误

有没有一种方法可以为ZendFramework2中的事件dispatch.error附加事件监听器,其中该监听器将仅附加到与Module.php相关的EventManager?我通过将dispatch的监听器附加到全局SharedManager并将当前Module.php的命名空间作为第一个参数传递来实现这一点。它工作得很漂亮,但当我对dispatch.error尝试相同时,它不起作用。这是Module.php中的示例:publicfunctioninit(ModuleManager$moduleManager){$sharedManager=$moduleManager->getEv

php - 带有授权检查器的 Symfony kernel.response 监听器

我正在设置一个kernel.response事件,我想测试用户是否已登录。这是我的代码:services.ymlapp.kernel.modal_injection:class:App\UserBundle\EventListener\ModalListenertags:-{name:kernel.event_listener,event:kernel.response}arguments:-@security.authorization_checkerModalListener.phpsecurityChecker=$securityChecker;}publicfunctionon

php - 错误 : No route found for "GET/app/example"

我刚刚使用SymfonyInstaller在我的Windows10笔记本电脑上创建了一个Symfony应用程序.然后,我开始了:phpapp/consoleserver:run然后,我打开了http://localhost:8000/app/example如文档中所述,但我收到以下错误消息:ERROR-UncaughtPHPExceptionSymfony\Component\HttpKernel\Exception\NotFoundHttpException:"Noroutefoundfor"GET/app/example""atC:\Users\JVerstry\morepath\

php - 即将到来的 SHA-256 : Do I need to update my IPN listener that does not use a secure URL?

我目前只使用支付按钮,以及我从https://github.com/paypal/ipn-code-samples获得的IPNphp脚本日期为2014年11月10日。我的脚本只是在没有加密的情况下回传到www.paypal.com。加密是否成为强制性要求? 最佳答案 您的IPN监听器将负责接收PayPal回调并将它们发送到PayPal进行验证。在这一点上,您的服务器与PayPal端点之间的连接将需要使用SHA-2进行加密。所以从字面上看是的,您需要检查您的服务器keystore/信任库并确保它包含SHA-2兼容证书。你可以引用这个P

php - 交响乐 4 : Event listener Cannot autowire UserInterface

当我将UserInterface添加到我的事件监听器时,出现以下错误:Cannotautowireservice"App\EventListener\ControllerListener":argument"$user"ofmethod"__construct()"referencesinterface"Symfony\Component\Security\Core\User\UserInterface"butnosuchserviceexists.Itcannotbeauto-registeredbecauseitisfromadifferentrootnamespace.我不知道发

php - Symfony2 监听器的命名

我已经阅读了一些关于Symfonys事件系统的指南/教程。但我仍然不确定命名最佳实践。不幸的是,大多数文档都使用默认方案,如登录等。所以这是一个游戏示例:一个命令评估某种匹配结果。它会像这样触发一个适当的事件:$dispatcher->dispatch('game_bundle.match_won',newMatchWonEvent($match,$winner));现在我想注册几个听众来处理这个事件,例如一个用于将此发布到获胜者的Facebook页面,另一个用于为获胜者预订成就。在示例中,我发现处理登录事件的监听器主要称为类似LoginListener的名称。,但是这个名称不应该与它