简体   繁体   中英

Symfony3 404 NotFoundHttpException

I am developing with Symfony3, and now my problem is "404 error" when trying to access " http://localhost:8000/auth page"

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

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 is in GuideBundle\\Entity folder

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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