简体   繁体   English

Symfony3 404 NotFoundHttpException

[英]Symfony3 404 NotFoundHttpException

I am developing with Symfony3, and now my problem is "404 error" when trying to access " http://localhost:8000/auth page" 我正在使用Symfony3进行开发,现在我的问题是“404错误”,当我尝试访问“ http:// localhost:8000 / auth page”时

dev.log 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  []

It worked before (I don't remember what I had done to fail it). 它以前工作过(我不记得我做了什么让它失败了)。 My routing.yml 我的routing.yml

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

SecurityController.php 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 is in GuideBundle\\Entity folder 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
}

Can anyone say what can cause such type of problem? 谁能说什么会导致这类问题?

This YML 这个YML

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

Will conflict with your annotation 会与您的注释发生冲突

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
    }

}

Use one and not both, check your config to see which you SHOULD be using. 使用一个而不是两个,检查您的配置,看看你应该使用哪个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM