2016-12-25 30 views
0

私は、Mac OSXエルキャピタンにsymfonyの3.2.0でアプリを開発していると私はhttp://127.0.0.1:8000/category/createを見ることができるが、私は/カテゴリ/編集/ 1に行くとき、私はこの404エラーを取得:Symfonyがこのルートを見つけられないのはなぜですか?

ここ
No route found for "GET /category/edit/1" 

私のCategoryController.phpです:

<?php 

namespace AppBundle\Controller; 

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

class CategoryController extends Controller 
{ 
    /** 
    * @Route("/categories", name="category_list") 
    */ 
    public function indexAction(Request $request) 
    { 
     // replace this example code with whatever you need 
     return $this->render('category/index.html.twig', [ 
      'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR, 
     ]); 
    } 

    /** 
    * @Route("/category/create", name="category_create") 
    */ 
    public function createAction(Request $request) 
    { 
     // replace this example code with whatever you need 
     return $this->render('category/create.html.twig', [ 
      'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR, 
     ]); 
    } 

    /** 
    * @Route("/category/edit/{id}", name="category_edit") 
    */ 
    public function editAction(Request $request) 
    { 
     // replace this example code with whatever you need 
     return $this->render('category/edit.html.twig', [ 
      'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR, 
     ]); 
    } 

    /** 
    * @Route("/category/delete/{id}", name="category_delete") 
    */ 
    public function deleteAction(Request $request) 
    { 

    } 
} 

カテゴリフォルダにedit.html.twigファイルを作成しました。

[email protected] ~/Projects/eventcalendar $ php bin/console debug:router --env=prod                 [ruby-2.2.1] 
----------------- -------- -------- ------ ----------------------- 
    Name    Method Scheme Host Path 
----------------- -------- -------- ------ ----------------------- 
    category_list  ANY  ANY  ANY /categories 
    category_create ANY  ANY  ANY /category/create 
    category_delete ANY  ANY  ANY /category/delete/{id} 
    homepage   ANY  ANY  ANY /
    event_list  ANY  ANY  ANY /events 
    event_create  ANY  ANY  ANY /event/create 
    category_edit  ANY  ANY  ANY /event/edit/{id} 
    event_delete  ANY  ANY  ANY /event/delete/{id} 
----------------- -------- -------- ------ ----------------------- 
+0

prod envのキャッシュをクリアしましたか? – Federkun

+0

@Federkun、私はやったと私は同じエラーメッセージが表示されます。 – Daniel

+0

'php bin/consoleデバッグの出力は何ですか?router --env = prod'? – Federkun

答えて

2

これをデバッグするための良い方法は、このコマンドを実行することです:

php bin/console debug:router --env=prod 

これはあなたに彼らのパスを持つすべてのルートを示しており、(この場合のように)それらが上書きされているかどうかを確認します同じ名前の他のルートによって

関連する問題