1

I am new to symfony and maybe I am missing something really simple but I am not able to spot it. Any help will be much appreciated. I have these two files:

C:\xampp\htdocs\Symfony\src\Apps01\ResourceCalBundle\Resources\config\routing.yml

ResourceCalendar_Login:
    pattern:   /resourcecalendar/login
    defaults:  { _controller: AppsRollerResourceCalBundle:Login:DisplayLogin }

C:\xampp\htdocs\Symfony\src\Apps01\ResourceCalBundle\Controller\LoginController.php

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

class LoginController
{
public function DisplayLoginAction()
{
    return new Response('<html><body>Hello There!</body></html>');
}
}

Yet when I point my browser to http://example.com/Symfony/web/app_dev.php/resourcecalendar/login I get the following error:

 The autoloader expected class "Apps01\ResourceCalBundle\Controller\LoginController" to be defined in file "C:\xampp\htdocs\Symfony/src/\Apps01\ResourceCalBundle\Controller\LoginController.php". The file was found but the class was not in it, the class name or namespace probably has a typo.
 500 Internal Server Error - RuntimeException 

Can someone point out what I am missing when I can see that the class LoginController is definitely there inside the filer?

Thanks Al

1 Answer 1

1

I think first of all you should define a namespace

namespace Apps01\ResourceCalBundle\Controller;

as your error told you here:

"namespace probably has a typo."

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks that was it. I tried to go through the documentation but did not catch it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.