0
votes

I have just gotten started with Symfony and I am struggling to load the Default controller.php. I have checked all the files and not sure where I am going wrong. My error is;

CRITICAL - Uncaught PHP Exception InvalidArgumentException: "The "DefaultController" (from the _controller value "DefaultController:Default:index") does not exist or is not enabled in your kernel!" at C:\Users\PC\Documents\xampp\htdocs\code\testProject\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser.php line 72 Context: {"exception":"Object(InvalidArgumentException)"}

My Controller is there;

enter image description here

And AppKernel.php references the directory

class AppKernel extends Kernel
{
public function registerBundles()
{
    $bundles = array(
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        new Symfony\Bundle\SecurityBundle\SecurityBundle(),
        new Symfony\Bundle\TwigBundle\TwigBundle(),
        new Symfony\Bundle\MonologBundle\MonologBundle(),
        new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
        new Symfony\Bundle\AsseticBundle\AsseticBundle(),
        new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
        new AppBundle\AppBundle(), << HERE

As far as I can tell the routing.dev and routing files are also correct

routing_dev.yml

_wdt:
resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
prefix:   /_wdt

_profiler:
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix:   /_profiler

_configurator:
resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
prefix:   /_configurator

_errors:
resource: "@TwigBundle/Resources/config/routing/errors.xml"
prefix:   /_error

_welcome:
pattern:  /
defaults: { _controller: DefaultController:Default:index }

_main:
resource: routing.yml

routing.yml

j_m_khello:
resource: "@jMKhelloBundle/Resources/config/routing.php"
prefix:   /

app:
resource: "@AppBundle/Controller"
type:     annotation

Any help greatly appreciated

1
Did you get this error with app.php or app_dev.php?smarber

1 Answers

3
votes

That's not a valid controller reference. The proper format is BundleName:ControllerName:action_name so for your application

AppBundle:Default:index