I am new to symfony framework just installed and trying to run the first code.
the problem is: as mentioned in the document I created the following two files.
///home/scriptkiddie/symfony/projects/project1/src/AppBundle/Controller/MainController.php
namespace AppBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
class MainController
{
public function contactAction()
{
return new Response('<h1>Contact us!</h1>');
}
}
====================================================================
///home/scriptkiddie/symfony/projects/project1/app/config/routing.yml
app:
resource: "@AppBundle/Controller/"
type: annotation
# app/config/routing.yml
contact:
path: /contact
defaults: { _controller: AppBundle:Main:contact }
~
Now, when I go the url http://localhost:8000/contact
I get the following error:
The autoloader expected class "AppBundle\Controller\MainController" to be defined in file "/home/scriptkiddie/symfony/projects/project1/src/AppBundle/Controller/MainController.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