URI {url} 的控制器不可调用

问题描述

目前我正在学习用 Symfony 制作的 Pimcore(我是 Laravel 人:3)所以我有他的错误

The controller for URI "/article/1132/This%20is%20my%20first%20post%20in%20Pimcore" is not callable:
 Expected method "blogarticleAction" on class "AppBundle\Controller\DefaultController".

我正在尝试根据其 ID 获取博客文章的)对象,然后将该博客文章显示用户

我用 blogarticleAction 方法制作了那个控制器:

<?PHP

namespace AppBundle\Controller;

use Pimcore\Controller\FrontendController;
use Symfony\Component\HttpFoundation\Request;
use Pimcore\Model\DataObject;

class MyContentController extends FrontendController
{
    public function defaultAction(Request $request)
    {
        //$this->view->blogpostList = new DataObject\Blogpost\Listing();
        $list = new DataObject\Blogpost\Listing();

        $paginator = new \Zend\Paginator\Paginator($list);
        $paginator->setCurrentPageNumber( $request->get('page') );
        $paginator->setItemCountPerPage(3);
        $this->view->paginator  = $paginator;
    }

    public function blogarticleAction(Request $request)
    {
        $this->view->blogarticle = DataObject\Blogpost::getById($this->getParameter('id'));
    }
}

此外,这是来自 Pimcore 管理面板static routehttps://prnt.sc/w96ya3

链接似乎正确形成: https://prnt.sc/w96zvn

但是当我单击该链接转到单个博客文章时,我得到了以下信息: https://prnt.sc/w970kg

解决方法

错误指出该方法应该存在于 DefaultController 而不是 MyContentController。在静态路由的屏幕截图中,您仅使用了 DefaultController。