爲什麼SonataAdminBundle操作列表無操作'編輯'。只有一個'刪除'。在教程中,我看到這個操作應該是prisutstyvat默認的。如何在管理頁面添加此操作? 我UserAdmin.php:在SonataAdminBundle中缺少操作'編輯'
<?php
// src/Acme/DemoBundle/Admin/PostAdmin.php
namespace Acme\AdminBundle\Admin;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
class UserAdmin extends Admin
{
protected $baseRoutePattern = 'users';
// Fields to be shown on create/edit forms
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('first_name', 'text')
->add('last_name', 'text')
->add('username', 'text')
->add('email', 'text')
->add('plainPassword', 'password')
->add('roles','choice',array('choices'=>$this->getConfigurationPool()->getContainer()->getParameter('security.role_hierarchy.roles'),'multiple'=>true));
;
}
// Fields to be shown on filter forms
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('id')
->add('first_name')
->add('last_name')
->add('username')
->add('email')
;
}
// Fields to be shown on lists
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->add('id')
->add('first_name')
->add('last_name')
->add('username')
->add('email')
->add('roles')
;
}
}