2017-12-27 44 views
0

안녕하세요. 저는 2.7에서 symfony4로 마이그레이션 중입니다. 나는 몇 번들을해야합니까 내가 지시에 따라 : https://symfony.com/doc/current/routing/external_resources.htmlSymfony4 번들의 외부 경로

내 설정/bundle.php :

... 
App\Frontend\MainBundle\FrontendMainBundle::class => ['all' => true], 
... 

내 설정/routes.yaml : 나는 메시지를 받았습니다

frontend_main: 
    resource: "@AppFrontendMainBundle/Resources/config/routing.frontend.main.yml" 
       #also tried here without App 

:

"frontend_main"에서 "resource"옵션을 인식 할 수 없습니다.

내가 뭘 잘못 했니?

+0

: 당신이 당신의 파일 이름을 유지하려면

protected function configureRoutes(RouteCollectionBuilder $routes) { $confDir = $this->getProjectDir().'/config'; if (is_dir($confDir.'/routes/')) { $routes->import($confDir.'/routes/*'.self::CONFIG_EXTS, '/', 'glob'); } if (is_dir($confDir.'/routes/'.$this->environment)) { $routes->import($confDir.'/routes/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); } $routes->import($confDir.'/routes'.self::CONFIG_EXTS, '/', 'glob'); } 

당신은 단지 마지막으로 가져온 이름을 변경 (또는 다른 하나를 추가) 할 수 있습니다 a 번들이 존재하지 않습니다. 내가 번들을 가지고 있지 않기 때문에 놀라운 일은 아닙니다. 인식 할 수없는 오류는 서식 지정/들여 쓰기 오류와 비슷합니다. config/routing.yaml에 다른 것이 있습니까? – Cerad

답변

1

Flex 디렉토리 구조가있는 Symfony 4에서 기본 라우팅 파일은 config/routes.yaml이 아니라 routing.yaml입니다. 파일이 라우팅의 일부로로드되고 서비스 구성으로로드되지 않았습니까?

라우팅 구성 커널을 src/Kernel.php으로 확인하십시오. 기본적으로는 다음과 같습니다 : 나는 당신의 자원 코드에 붙여 얻은

$routes->import($confDir.'/routing'.self::CONFIG_EXTS, '/', 'glob'); 
+0

예, 기본값입니다. 죄송합니다. 철자 오류였습니다. 그것은 물론 routes.yaml입니다. symfony4의 절대 기본값. – craphunter