无法找到路径控制器(Symfony教程)

时间:2015-10-14 09:42:37

标签: php symfony doctrine-orm content-management-system

我正在关注Symfony CMS的在线教程: http://symfony.com/doc/master/cmf/tutorial/introduction.html

在最后一页上创建了路由(很抱歉,我无法粘贴本教程页面的链接,因为StackOverflow会阻止链接数量)

但我无法查看任何页面。我应该在哪里寻找错误?实际上,debug:router没有列出任何带帖子的url。但doctrine:phpcr:node:dump列出了包含帖子的节点。教程提供检查以下URL: localhost:8000/page/home

他们的机器人给出了ERROR: Unable to find the controller for path "/page/home". The route is wrongly configured. 404 Not Found - NotFoundHttpException

c:\Bitnami\wampstack-5.4.38-0\sym_prog\simpleCMS>php app/console doctrine:phpcr:node:dump
ROOT:
  cms:
    routes:
      page:
        home:
      post:
        2015-10-14:
          my-first-post:
          my-second-post:
          my-third-post:
          my-fourth-post:
    pages:
      Home:
    posts:
      My First Post:
      My Second Post:
      My Third Post:
      My Fourth Post:


c:\Bitnami\wampstack-5.4.38-0\sym_prog\simpleCMS>php app/console debug:router
[router] Current routes
 Name                     Method Scheme Host Path
 _wdt                     ANY    ANY    ANY  /_wdt/{token}
 _profiler_home           ANY    ANY    ANY  /_profiler/
 _profiler_search         ANY    ANY    ANY  /_profiler/search
 _profiler_search_bar     ANY    ANY    ANY  /_profiler/search_bar
 _profiler_purge          ANY    ANY    ANY  /_profiler/purge
 _profiler_info           ANY    ANY    ANY  /_profiler/info/{about}
 _profiler_phpinfo        ANY    ANY    ANY  /_profiler/phpinfo
 _profiler_search_results ANY    ANY    ANY  /_profiler/{token}/search/results
 _profiler                ANY    ANY    ANY  /_profiler/{token}
 _profiler_router         ANY    ANY    ANY  /_profiler/{token}/router
 _profiler_exception      ANY    ANY    ANY  /_profiler/{token}/exception
 _profiler_exception_css  ANY    ANY    ANY  /_profiler/{token}/exception.css
 _configurator_home       ANY    ANY    ANY  /_configurator/
 _configurator_step       ANY    ANY    ANY  /_configurator/step/{index}
 _configurator_final      ANY    ANY    ANY  /_configurator/final
 _twig_error_test         ANY    ANY    ANY  /_error/{code}.{_format}
 acme_basic_cms_homepage  ANY    ANY    ANY  /hello/{name}
 homepage                 ANY    ANY    ANY  /

C:\ Bitnami \ wampstack-5.4.38-0 \ sym_prog \ simpleCMS \应用\配置\ routing.yml中

acme_basic_cms:
    resource: "@AcmeBasicCmsBundle/Resources/config/routing.yml"
    prefix:   /  
app:
    resource: "@AppBundle/Controller/"
    type:     annotation

C:\ Bitnami \ wampstack-5.4.38-0 \ sym_prog \ simpleCMS \ SRC \ Acme公司\ BasicCmsBundle \资源\配置\ routing.yml中

acme_basic_cms_homepage:
    path:     /hello/{name}
    defaults: { _controller: AcmeBasicCmsBundle:Default:index }

但是还有一个路由文件,据我所知,这个文件并不适用于simpleCMS \ app \ config \ routing.yml。它是 C:\ Bitnami \ wampstack-5.4.38-0 \ sym_prog \ simpleCMS \ SRC \ Acme公司\ BasicCmsBundle \资源\配置\ cmf_routing_auto.yml

的src / Acme公司/ BasicCmsBundle /资源/配置/ cmf_routing_auto.yml

Acme\BasicCmsBundle\Document\Page:
    uri_schema: /page/{title}
    token_providers:
        title: [content_method, { method: getTitle }]

Acme\BasicCmsBundle\Document\Post:
    uri_schema: /post/{date}/{title}
    token_providers:
        date: [content_datetime, { method: getDate }]
        title: [content_method, { method: getTitle }]

也许我必须将这个“simpleCMS \ src \ Acme \ BasicCmsBundle \ Resources \ config \ cmf_routing_auto.yml”添加到“simpleCMS \ app \ config \ routing.yml”。

0 个答案:

没有答案