我是Symfony 3的新手。我在AppBundle本身創建了控制器文件。沒有創建新的包。現在我試圖路由一個新的頁面,它會給出一個錯誤。這就是我所做的。在symfony 3的routing.yml中應該編輯什麼來創建一個從註釋中創建新路線?
在src\AppBundle\Controller\Patient\PatientController.php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class DefaultController extends Controller
{
/**
* @Route("/patient", name="patient_homepage")
*/
public function patientHomeAction(Request $request)
{
// replace this example code with whatever you need
return $this->render('Patient/home.html.twig', array()
);
}
在app\Resources\views\base.html.twig
<a href="{{ path('patient_homepage') }}">Home</a>
這給出了一個錯誤的
無法 「異常被模板 的渲染(期間拋出」生成指定路線「patient_homepage」的URL爲 這樣的路線不存在。「)在base.html.twig第118行。」
我是否需要對app\config\routing.yml
進行任何更改?我在這裏錯過了什麼。