本文整理汇总了PHP中Sonata\AdminBundle\Admin\AdminInterface::getBaseControllerName方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminInterface::getBaseControllerName方法的具体用法?PHP AdminInterface::getBaseControllerName怎么用?PHP AdminInterface::getBaseControllerName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\AdminBundle\Admin\AdminInterface
的用法示例。
在下文中一共展示了AdminInterface::getBaseControllerName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onKernelRequest
/**
* @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
* @throws \RuntimeException
*/
public function onKernelRequest(GetResponseEvent $event)
{
$request = $event->getRequest();
if (!$request) {
return;
}
if (!$request->hasSession()) {
return;
}
$adminCode = $request->get('_sonata_admin');
if (!is_null($adminCode)) {
$this->admin = $this->adminPool->getAdminByAdminCode($adminCode);
if (!$this->admin) {
throw new \RuntimeException(sprintf('Unable to find the admin class related to the current controller (%s)', get_class($this)));
}
if (method_exists($this->admin, 'getTrackedActions')) {
foreach ($this->admin->getTrackedActions() as $trackedAction) {
// if an action which is flagged as 'to be tracked' is matching the end of the route: add info to session
if (preg_match('#' . $trackedAction . '$#', $request->get('_route'), $matches)) {
$this->updateTrackedInfo($request->getSession(), '_networking_initcms_admin_tracker', array('url' => $request->getRequestUri(), 'controller' => $this->admin->getBaseControllerName(), 'action' => $trackedAction));
}
}
}
}
}