gpt4 book ai didi

php - FOSUserBundle managing In EasyAdminBundle(( The "User"entity must define its associated Doctrine entity class using the "class"option))Symfony

转载 作者:可可西里 更新时间:2023-11-01 12:18:54 24 4
gpt4 key购买 nike

我正在使用带有 FOSUserBundle~2.0 和 EasyAdminBundle^1.17 的 Symfony 3.4。一切正常。我可以登录系统并创建用户((当然有推荐行))我使用这个 toutaril但是当我想在 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: AppBundle\Entity\User
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 AppBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="fos_user")
*/
class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(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: AppBundle\Entity\User
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 - FOSUserBundle managing In EasyAdminBundle(( The "User"entity must define its associated Doctrine entity class using the "class"option))Symfony,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49044716/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com