当我点击sonata admin中一行旁边的删除时,它不会删除该行。
当我点击"删除"我说我试图删除新闻稿。新闻发布上的按钮,网址更改为/ pressreleases / 3 / delete,我被重定向回我的管理控制台,但删除操作不会发生。这发生在我的所有实体上。但是,我的编辑"按钮工作,允许我编辑一行。
代码示例(向下滚动到configureListFields):
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Form\FormMapper;
class AboutPressReleasesAdmin extends Admin
{
// setup the default sort column and order
protected $datagridValues = array(
'_sort_order' => 'asc',
'_sort_by' => 'id'
);
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('title')
->add('text', 'textarea', array('required' => false, 'attr' => array('class' => 'tinymce', 'data-theme' => 'advanced')))
->add('created_at', 'date', array('required' => true))
;
}
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('title')
->add('text')
;
}
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('title')
->add('text')
->add('created_at')
->add('updated_at')
->add('updated_by')
// add custom action links
->add('_action', 'actions', array(
'actions' => array(
'edit' => array(),
'delete' => array(),
)
))
;
}
}
我错过了什么?