Tôi đã cố cài đặt gói quản trị sonata để quản trị người dùng của mình.gói quản trị sonata symfony
Tôi sử dụng gói người dùng FOS.
Tôi đã tuân theo các hướng dẫn, nhưng mọi thứ đều sai và tôi không tìm thấy gì.
Tôi có lỗi:
Không thể tự động xác định tên đường cơ sở, xin vui lòng xác định một giá trị mặc định baseRouteName
cho lớp quản trị UserBundle\Admin\UserAdmin
trong C: \ Users \ Alexandre \ hubiC \ www \ câu hỏi \ app/config. (được nhập từ "C: \ Users \ Alexandre \ hubiC \ www \ questionnaire \ app/config \ routing.yml").
Trong dịch vụ của tôi, tôi có:
services:
sonata.admin.user:
class: UserBundle\Admin\UserAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "Content", label: "User" }
arguments:
- ~
- UserBundle\Entity\User
- ~
calls:
- [ setTranslationDomain, [UserBundle]]
Trong cấu hình của tôi:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
- { resource: @UserBundle/Resources/config/admin.yml }
sonata_block:
default_contexts: [cms]
blocks:
# Enable the SonataAdminBundle block
sonata.admin.block.admin_list:
contexts: [admin]
# Your other blocks
Và file UserAdmin:
<?php //
namespace UserBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
class UserAdmin extends Admin
{
// Fields to be shown on create/edit forms
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('nom')
->add('prenom')
->add('adresse')
->add('npa')
->add('localite')
->add('entreprise')
;
}
// Fields to be shown on filter forms
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('nom')
->add('prenom')
->add('adresse')
->add('npa')
->add('localite')
->add('entreprise')
;
}
// Fields to be shown on lists
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('nom')
->add('prenom')
->add('adresse')
->add('npa')
->add('localite')
->add('entreprise')
;
}
}
tập tin trong thư mục UserBundle/quản lý này.
Điều gì đã xảy ra?
Cảm ơn
Tôi đã tìm phương thức trong tệp admin.php, nhưng tôi phải thay đổi giá trị của lợi nhuận là gì? Hoặc làm thế nào để xác định các biến $ baseRouteName? Tên bạn là gì"? – anubis
your_name là chuỗi tùy chỉnh. Bạn có thể nhập 'abc'. Sonata cách thông thường xác định chuỗi này từ tên gói của bạn. –
Ok, hoạt động nhưng bây giờ tôi truy cập vào bảng điều khiển và có các thực thể của mình, nhưng nếu tôi nhấp vào danh sách, tôi không có thực thể của mình, nhưng tôi cho rằng điều đó không liên quan đến giải pháp của vấn đề của tôi? – anubis