Управление FOSUserBundle В EasyAdminBundle ((сущность «Пользователь» должна определить связанный с ней класс сущности Doctrine, используя опцию «класс»)) Symfony

Я использую Symfony 3.4 с FOSUserBundle ~ 2.0 и EasyAdminBundle ^ 1.17.everything работает отлично. Я могу войти в систему и создать пользователя ((конечно, со строкой похвалы)) я использую это toutaril
но когда я хочу управлять в EasyAdminBundle.i есть эта ошибка

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
}
}

9

Решение

Все ваши параметры для сущности User должны быть вложены в User

    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' } } }
5

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector