当我运行服务器并尝试URL时,我收到错误404.
的src /的appbundle /资源/配置/ routing.yml中
app_category:
resource: "@AppBundle/Resources/config/routing/category.yml"
prefix: /category
的src /的appbundle /资源/配置/路由/ category.yml
category:
path: /
defaults: { _controller: "AppBundle:Category:index" }
category_new:
path: /new
defaults: { _controller: "AppBundle:Category:new" }
CategoryController
class CategoryController extends Controller
{
/**
* Lists all Category entities.
*
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('AppBundle:Category')->findAll();
return $this->render('AppBundle:Category:index.html.twig', array(
'entities' => $entities,
));
}
public function newAction()
{
$entity = new Category();
$form = $this->createCreateForm($entity);
return $this->render('AppBundle:Category:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
}
}
我做错了什么?