When I click delete next to a row in sonata admin it doesn't delete the row.
Say I'm trying to delete a press release, when I click the "delete" button on a press release the url changes to /pressreleases/3/delete and I get redirected back to my admin dashboard but the delete action doesn't happen. This happens for all my entities. However, my "edit" button works and allows me to edit a row.
Code example (scroll down to 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(),
)
))
;
}
}
What am I missing ?