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}
----------------- -------- -------- ------ -----------------------
prod envのキャッシュをクリアしましたか? – Federkun
@Federkun、私はやったと私は同じエラーメッセージが表示されます。 – Daniel
'php bin/consoleデバッグの出力は何ですか?router --env = prod'? – Federkun