I read the Symfony (http://symfony.com/doc/current/cookbook/controller/error_pages.html#testing-error-pagesdocumentation) and did what they say:
I created 2 files, error404.html.twig and error500.html.twig in the directory (myproject)/app/Resources/TwigBundle/views/Exception/
And I changed the routing_dev.yml file like this:
_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
_main:
resource: routing.yml
_errors:
resource: "@TwigBundle/Resources/config/routing/errors.xml"
prefix: /_error
When I try to see what it looks like with http://localhost:8080/portfolio/web/app_dev.php/_error/404
I get the following error:
FileLoaderLoadException: Cannot import resource "@TwigBundle/Resources/config/routing/errors.xml" from "C:\xampp\htdocs\portfolio\app/config/routing_dev.yml". Make sure the "TwigBundle/Resources/config/routing/errors.xml" bundle is correctly registered and loaded in the application kernel class.
I checked my AppKernel.php file and it seems like twigBundle IS imported:
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
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(),
new PublicBundle\PublicBundle(),
new AdminBundle\AdminBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
What's the probleme?