我正在研究symfony 3中的一个项目,我有以下代码,它返回一个Response实例
public function dashboardAction()
{
return parent::dashboardAction();
}
上述代码的父方法是:
public function dashboardAction()
{
$blocks = [
'top' => [],
'left' => [],
'center' => [],
'right' => [],
'bottom' => [],
];
foreach ($this->container->getParameter('sonata.admin.configuration.dashboard_blocks') as $block) {
$blocks[$block['position']][] = $block;
}
$parameters = [
'base_template' => $this->getBaseTemplate(),
'admin_pool' => $this->container->get('sonata.admin.pool'),
'blocks' => $blocks,
];
if (!$this->getCurrentRequest()->isXmlHttpRequest()) {
$parameters['breadcrumbs_builder'] = $this->get('sonata.admin.breadcrumbs_builder');
}
return $this->render($this->getAdminPool()->getTemplate('dashboard'), $parameters);
}
我想将变量articles
传递给Response实例中的视图。
我尝试过这样的事情
return $this->render(parent::dashboardAction(), array(
'articles' => $articles,
));
但它不起作用。有什么帮助吗?