FOSUserBundle management In EasyAdminBundle(( "User" 实体必须使用 "class" 选项定义其关联的 Doctrine 实体类))Symfony



我正在使用symfony 3.4与fosuserbundle〜2.0和easyadminbundle^1.17.17.17.iverthing ntherthing有效。但是,当我想在EasyAdminbundle中进行管理。我有此错误

The "User" entity must define its associated Doctrine entity class using the "class" option.

这是我的config.yml

..
.
.
entities:
            User:
            label: 'user'
            list:
                 actions:
                        - {name: 'delete', label: 'del' }
                        - {name: 'edit' , lable: 'edite'}
                 title: 'user'
                 fields:
                        - username
                        - email
                        - enabled
                        - lastLogin
            class: AppBundleEntityUser
            form:
                fields:
                    - username
                    - email
                    - enabled
                    - lastLogin
                    # if administrators are allowed to edit users' passwords and roles, add this:
                    - { property: 'plainPassword', type: 'text', type_options: { required: false } }
                    - { property: 'roles', type: 'choice', type_options: { multiple: true, choices: { 'ROLE_USER': 'ROLE_USER', 'ROLE_ADMIN': 'ROLE_ADMIN' } } }
.
.
.

这是用户实体

<?php
namespace AppBundleEntity;
use FOSUserBundleModelUser as BaseUser;
use DoctrineORMMapping as ORM;
 /**
 * @ORMEntity
 * @ORMTable(name="fos_user")
 */
class User extends BaseUser
{
    /**
     * @ORMId
     * @ORMColumn(type="integer")
     * @ORMGeneratedValue(strategy="AUTO")
     */
    protected $id;
    public function __construct()
    {
        parent::__construct();
        // your own logic
    }
}

您对用户实体的所有选项都应嵌套在用户

    entities:
            User:
                label: 'user'
                list:
                     actions:
                        - {name: 'delete', label: 'del' }
                        - {name: 'edit' , lable: 'edite'}
                     title: 'user'
                     fields:
                        - username
                        - email
                        - enabled
                        - lastLogin
                class: AppBundleEntityUser
                form:
                    fields:
                      - username
                      - email
                      - enabled
                      - lastLogin
                      # if administrators are allowed to edit users' passwords and roles, add this:
                      - { property: 'plainPassword', type: 'text', type_options: { required: false } }
                      - { property: 'roles', type: 'choice', type_options: { multiple: true, choices: { 'ROLE_USER': 'ROLE_USER', 'ROLE_ADMIN': 'ROLE_ADMIN' } } }

最新更新