2016-04-12 19 views
0

サーバーを起動してhttp://127.0.0.1:8000にアクセスしようとすると、エラーUnable to generate a URL for the named route "login" as such route does not exist.が表示されます。 /ログインへ名前付きルート「ログイン」のURLを生成できません

直接アクセスができます:No route found for "GET /login"

これはsymfony3とし、FOSBUNDLEなしです! に基づいてsymfony3 cookbook traditional log form

のsecurity.yml:

securityController.php:

// src/AppBundle/Controller/SecurityContoller.php 
namespace AppBundle\Controller; 

use Symfony\Bundle\FrameworkBundle\Controller\Controller; 
use Symfony\Component\HttpFoundation\Request; 
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; 

class SecurityController extends Controller 
{ 
/** 
* @Route("/login", name="login") 
*/ 
public function loginAction(Request $request) 
{ 
    $authenticationUtils = $this->get('security.authentication_utils'); 

// login error, if there is one 
$error = $authenticationUtils->getLastAuthenticationError(); 

// last username entered 
$lastUsername = $authenticationUtils->getLastUsername(); 

return $this->render(
    'security/login.html.twig', 
    array(
    'last_username' => $lastUsername, 
    'error'   => $error, 
) 
); 
} 
} 
+0

あなたのrouting.ymlファイルは次のようにどのように見えるんように見える必要が

framework: router: resource: "%kernel.root_dir%/config/internal/routing.yml" strict_requirements: ~ 

:config.ymlファイルでは、ルーティングの一部を定義する必要がありますか? – Laoneo

+0

デフォルトでは、注釈を使用していても、手動でrouting.ymlに追加する必要がありますか? – Diamonte

+0

はい、ルーティングファイルを追加する必要があります。私は答えを掲示している、何が必要です。 – Laoneo

答えて

2

私はあなたがのrouting.ymlファイルが欠落していると思います。 routing.ymlファイルは、その後

php: 
    resource: "@AppBundle/Controller/" 
    type:  annotation 
関連する問題