0

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? Commented May 20, 2015 at 14:53

1 Answer 1

3

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

AppBundle:Default:index
Sign up to request clarification or add additional context in comments.

Comments

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.