我有管理课程
class LogAdmin extends AbstractAdmin
{
public function getParentAssociationMapping()
{
$em = $this->modelManager->getEntityManager('acme\Bundle\Entity\acme');
$className = $em->getClassMetadata(get_class($this->getParent()->getObject($this->getParent()->getRequest()->get('id'))))->getTableName();
return strtolower( $className );
}
protected function configureRoutes(RouteCollection $collection)
{
if ($this->isChild()) {
return;
}
// This is the route configuration as a parent
$collection->clear();
}
在sonata_admin.yml中
dashboard:
groups:
settings:
-mea.log.sonata.admin.log
服务:
mea.log.sonata.admin.log:
class: AppBundle\Sonata\Admin\LogAdmin
arguments: [~, AppBundle\Entity\Log, ~]
tags:
- { name: sonata.admin, manager_type: orm, label: "Logs" }
public: true
envio.admin.packet:
class: AppBundle\Sonata\Admin\PacketAdmin
arguments: [~, AppBundle\Entity\Packet, ~]
tags:
- { name: sonata.admin, manager_type: orm, label: Packet }
public: true
calls:
- [ addChild, ['@mea.log.sonata.admin.log', 'packet']]
- [ addChild, ['@mea.postbox.sonata.admin.thread', 'packet']]
- [ addChild, ['@envio.admin.shipment', 'packet']]
当我发表评论
// $collection->clear();
在奏鸣曲仪表板中,我看到日志
我删除评论时
$collection->clear();
日志菜单消失。可以将独立面板日志和日志作为子级吗?我需要克隆此管理类吗?