submit - 没有为 fosUserBundle symfony2.1 帐户配置编码器

标签 submit symfony-2.1 fosuserbundle encoder

提交连接表单时出现此错误(我使用 FOSUserBundle 最新版本):

No encoder has been configured for account "MyApp\UtilisateurBundle\Entity\Utilisateur

这是我的实体:
    <?php
namespace MyApp\UtilisateurBundle\Entity;
use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
 * @ORM\Entity
 */
class Utilisateur extends BaseUser
{
    /**
    * @ORM\Id
    * @ORM\Column(type="integer")
    * @ORM\generatedValue(strategy="AUTO")
    */
    protected $id;
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }
}

这是我的 app/config/security.yml :
imports:
- { resource: "@MyAppFilmothequeBundle/Resources/config/security.yml" }

这是我的 src/MyApp/FilmothequeBundle/Ressources/config/security.yml :
security:
providers:
    fos_userbundle:
        id: fos_user.user_manager

firewalls:
    main:
        pattern:      .*
        form_login:
            provider:       fos_userbundle
            login_path:     /myapp/login
            use_forward:    false
            check_path:     /myapp/login_check
            failure_path:   null
            default_target_path: /myapp
        logout:
            path:   /myapp/logout
            target: /myapp
        anonymous:    true

我按照本教程执行此操作:http://j-place.developpez.com/tutoriels/php/ameliorez-vos-applications-developpees-avec-symfony2/#LVI-B-1

我怎样才能做到这一点?
先感谢您

最佳答案

尝试将此添加到 security.yml 中的安全 key

encoders:
        FOS\UserBundle\Model\UserInterface: sha512

所以这是
security:
    encoders:
        FOS\UserBundle\Model\UserInterface: sha512

    providers:
        ...

    firewalls:
        ...

关于submit - 没有为 fosUserBundle symfony2.1 帐户配置编码器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13602229/

相关文章:

iphone - 无法上传应用程序 - 'An error occurred uploading to the itunes store'

javascript - 为什么这个自定义提交不起作用?

javascript - 使超链接成为表单提交按钮

php - FOS 用户/注册路径在 url 中有效但不作为路径

doctrine - Symfony 2.7/3 - Doctrine : You have requested a non-existent service "fos_user.doctrine_registry"

C# WebBrowser 控件 - 使用 InvokeMember ("Click"提交表单不工作)

symfony - 特定操作的响应事件监听器

symfony - 根据位置字段对 CollectionType 的 View 进行排序

mysql - 不会写;模式更新时表中的重复键

symfony - 使用 security.encoder_factory 加速 symfony2 fixtures 在测试中的加载