【问题标题】:Sonata Admin Bundle List with FosUserBundle带有 FosUserBundle 的 Sonata Admin Bundle 列表
【发布时间】:2018-07-22 03:03:56
【问题描述】:

我想根据连接的用户显示在列表中。 现在,我的列表显示了所有数据。

我的代码:

protected function configureListFields(ListMapper $listMapper)
    {
        unset($this->listModes['mosaic']);

        $listMapper
            /*->addIdentifier('id', null ,[
                'header_style' => 'width: 12.5%',    
            ])*/
            ->add('date', null ,[
                'header_style' => 'width: 14.2%',    
            ])
            ->add("nombreMatch", null ,[
                'header_style' => 'width: 14.2%',    
            ])
            ->add('cote', null ,[
                'header_style' => 'width: 14.2%',    
            ])
            ->add('mise', null ,[
                'header_style' => 'width: 14.2%',    
            ])
            ->add('gain', null ,[
                'header_style' => 'width: 14.2%',    
            ])
           ->add('benefice', null, array('template' => '@SonataAdmin/CRUD/Special/benefice_field_list.html.twig'))
           ->add('bankroolCourante', null ,[
                'header_style' => 'width: 14.2%',    
            ])
        ;
    }

我该怎么做?我希望有人有一个好的解决方案。 感谢您的帮助!

【问题讨论】:

    标签: php symfony fosuserbundle sonata


    【解决方案1】:

    您必须覆盖 CRUD 控制器中的 listAction 方法。因此,您必须 create your custom CRUD controller 扩展默认值。在您的控制器中,您应该覆盖 listAction。您可以从原始 CRUD 控制器中原始 listAction 的代码开始,该控制器可以在包内的 src/controller 目录中找到。

    【讨论】:

      猜你喜欢
      • 2016-04-20
      • 2016-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-06
      • 2016-10-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多