Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 985
Elya Korobova Avatar asked Feb 28 '26 08:02

Elya Korobova


1 Answers

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.

like image 88
Jake N Avatar answered Mar 03 '26 03:03

Jake N



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!