我有一个带有实体VenteAdmin.php
的管理员类名Vente
:
class VentesAdmin extends AbstractAdmin
{
protected function configureFormFields(FormMapper $formMapper)
{
// ...
}
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
}
protected function configureListFields(ListMapper $listMapper)
{
}
protected function configureShowFields(ShowMapper $showMapper)
{
}
}
这是我的services.yml
:
services:
admin.facture:
class: AppBundle\Admin\VentesAdmin
arguments: [~, AppBundle\Entity\Ventes, ~]
tags:
- { name: sonata.admin, manager_type: orm, group: Ventes, label: Facture, icon: "<i class=\"fa fa-file-text\"></i>" }
我希望通过同一个实体DevisAdmin.php
添加另一个管理类名Ventes
,但要添加其他listFields,showFields等。
我该怎么做?
答案 0 :(得分:1)
只需确保定义一个不同的服务ID,指向具有相同实体的新管理类:
services:
admin.devis:
class: AppBundle\Admin\DevisAdmin
arguments: [~, AppBundle\Entity\Ventes, ~]
tags:
- { name: sonata.admin, manager_type: orm, group: Devis, label: Devis, icon: "<i class=\"fa fa-file-text\"></i>" }