Answer the question
In order to leave comments, you need to log in
Writes that the controller is not found?
I do according to symfony.com/doc/current/quick_tour/the_big_picture.html
Error:
The autoloader expected class "App\AppBundle\Controller\DefaultController" to be defined in file
"/home/vagrant/Code/testsite/vendor/composer/../../src/AppBundle/Controller/DefaultController.php". The file was found but
the class was not in it, the class name or namespace probably has a typo in
/home/vagrant/Code/testsite/config/services.yaml (which is loaded in resource
"/home/vagrant/Code/testsite/config/services.yaml").
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
public function indexAction()
{
$welcome = 'Hello World!';
$this->render('index.html.twig', array(
'welcome' => $welcome,
));
}
}
# config/routing.yml
index:
path: /
defaults: { _controller: AppBundle:DefaultController:index }
/**
* @Route("/", name="homepage")
*/
public function indexAction()
{
Answer the question
In order to leave comments, you need to log in
The autoloader expected class "App\AppBundle\Controller\DefaultController" namespace was written somewhere in a curve. in the controller you showed the namespace AppBundle\Controller\DefaultController
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question