Symfony3 404 NotFoundHttpException

时间:2016-04-18 16:53:29

标签: php http-status-code-404 symfony

我正在使用Symfony3进行开发,现在我的问题是“404错误”,当我尝试访问“http://localhost:8000/auth页面”

dev.log

[2016-04-18 18:30:14] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "GuideBundle\Entity\MedicalStaff object not found." at D:\Elya\КПИ\6 семестр\TSPP\mg\vendor\sensio\framework-extra-bundle\Request\ParamConverter\DoctrineParamConverter.php line 66  []

之前有效(我不记得我做了什么让它失败了)。 我的 routing.yml

auth:
    path: /auth
    defaults: {_controller: GuideBundle:Security:login}

SecurityController.php

 class SecurityController extends Controller
    {
        /**
         * @Route("/auth", name="auth")
         */
        public function loginAction(Request $request)
        {
            //Here is the code, If I comment It nothing changes and I don't use here any MedicalStaff object
        }

    }

MedicalStaff.php 位于GuideBundle \ Entity文件夹

namespace GuideBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * MedicalStaff
 *
 * @ORM\Table(name="medical_staff")
 * @ORM\Entity(repositoryClass="GuideBundle\Repository\MedicalStaffRepository")
 */
class MedicalStaff
{
    //here are methods and properties
}

有谁可以说会导致这类问题?

1 个答案:

答案 0 :(得分:1)

这个YML

->save()

会与您的注释冲突

auth:
    path: /auth
    defaults: {_controller: GuideBundle:Security:login}

使用一个而不是两个,检查您的配置,看看您应该使用哪个。