SonataAdmin 挂钩未触发

SonataAdmin hooks are not firing

我有 Symfony 2.8。我使用 SonataAdminBundle v2.3 + a2lix/TranslationFormBundle v2.1 + SonataMediaBundle v2.3。我有 NewsAdmin class:

class NewsAdmin extends Admin
{
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->add('translations', 'a2lix_translations', ['fields' => [
                'content' => [
                    'field_type' => 'ckeditor',
                ]
            ]])
            ->add('excerptImage', 'sonata_type_model_list', [], [
                'link_parameters' => ['context' => 'default'],
                'require' => false
            ])
            ->add('excerptImageSide')
            ->add('category', 'sonata_type_model', [
                'class' => 'AppBundle\Entity\NewsCategory',
                'property' => 'shortName'
            ])
        ;
    }

    // configureDatagridFilters(), configureListFields() ...

    // Does not firing!
    public function postUpdate($news)
    {
        dump('preUpdate');
    }

    // Does not firing!
    public function prePersist($news)
    {
        dump('prePersist');
    }
} 

问题是 postUpdateprePersist 方法都没有触发,所以我没有在网络分析器字符串 'preUpdate' 或 'prePersist' 中看到。为什么会这样?以及如何解决这个问题?

P.S。如果您需要更多信息,请告诉我。

只需添加 die,您就会看到 dump

public function prePersist($news)
{
    dump('prePersist');
    die;
}

编辑

那是因为 dump 不是直接从呈现视图的控制器操作调用,也不是从操作调用的方法调用,而是在完全独立的 EventListener 中调用。