简体   繁体   English

ajaxfosuserbundle注册symfony 2.8

[英]ajaxfosuserbundle registration symfony 2.8

I'm using AjaxFOSuserBundle 我正在使用AjaxFOSuserBundle

and trying to make registration via ajax, but getting an error. 并尝试通过ajax进行注册,但出现错误。 What does it mean? 这是什么意思?

Catchable Fatal Error: Argument 1 passed to FOS\\UserBundle\\EventListener\\AuthenticationListener::authenticate() must be an instance of FOS\\UserBundle\\Event\\FilterUserResponseEvent, instance of Tecnocreaciones\\Bundle\\AjaxFOSUserBundle\\Event\\FilterUserResponseEvent given 可捕获的致命错误:传递给FOS \\ UserBundle \\ EventListener \\ AuthenticationListener :: authenticate()的参数1必须是FOS \\ UserBundle \\ Event \\ FilterUserResponseEvent的实例,Tecnocreaciones \\ Bundle \\ AjaxFOSUserBundle \\ Event \\ FilterUserResponseEvent的实例

$(function ()
{
    $('form#fos_user_registration_form').submit(function (e) {

        e.preventDefault();
        var $this = $(e.currentTarget);

        inputs = {};
        // Send all form's inputs
        $.each($this.find('input'), function (i, item) {
            var $item = $(item);
            inputs[$item.attr('name')] = $item.val();
        });
        // Send form into ajax
        $.ajax({
            url: $this.attr('action'),
            type: 'POST',
            dataType: 'json',
            data: inputs,
            success: function (data) {
                if (data.has_error) {
                    // Insert your error process
                    alert('WRONG');
                }
                else {
                    // Insert your success process
                    alert('check your email!');
                }
            }
        });
    });
});
  • It seems to be a problem with the AjaxFOSUserBundle code. AjaxFOSUserBundle代码似乎有问题。 The FilterUserResponseEvent from AjaxFOSUserBundle should extends FOSUserBundle class. AjaxFOSUserBundle的FilterUserResponseEvent应该扩展FOSUserBundle类。

You should post your issue on the github project. 您应该将您的问题发布在github项目上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM