Search code examples
linuxsymfonydirectorydemo

How to explore Symfony AcmeDemoBundle pages and code


I'm having problems finding my way to the AcmeDemo pages (or where to find the underlying PHP files for that matter) on the development server. I included the AcmeDemoBundle when setting up my first Symfony project but I've not been able to find anything meaningful so far. The directory structure of where I've set up my Project is:

/home/<username>/<SymfonyProject>/app/
                                 /bin/
                                 /src/Acme
                                     /AppBundle
                                 /vendor/
                                 /web/bundles/acmedemo (symbolic link)
                                             /framework (symbolic link)
                                             /sensiodistribution (symbolic link)

I've been trying variations of http://localhost:8000/acmedemo along with the contents of the symbolic links but these only seem to lead to css and images directories so I'm at a bit of a loss how to get to the Acme Demo.


Solution

  • You are browsing the prod environment, in this contest the acmedemobundle is disabled by default: take a look at the file: app/AppKernel.php

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }
    

    So for browse the acmedemobundle project you can go to:

    http://localhost:8000/app_dev.php/demo
    

    Or enable the bundle in prod environment (generally don't do that!).