[FrameworkBundle] updated skeleton with the web profiler configuration

This commit is contained in:
Fabien Potencier 2010-09-01 10:33:48 +02:00
parent 4e57899374
commit ebae1d7bf2
13 changed files with 70 additions and 17 deletions

View File

@ -5,12 +5,6 @@ require_once __DIR__.'/../src/autoload.php';
use Symfony\Framework\Kernel;
use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
use Symfony\Framework\KernelBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\ZendBundle\ZendBundle;
use Symfony\Bundle\DoctrineBundle\DoctrineBundle;
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle;
class {{ class }}Kernel extends Kernel
{
public function registerRootDir()
@ -21,18 +15,24 @@ class {{ class }}Kernel extends Kernel
public function registerBundles()
{
$bundles = array(
new KernelBundle(),
new FrameworkBundle(),
new Symfony\Framework\KernelBundle(),
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
// enable third-party bundles
new ZendBundle(),
new DoctrineBundle(),
new SwiftmailerBundle(),
new Symfony\Bundle\ZendBundle\ZendBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
//new Symfony\Bundle\DoctrineMigrationsBundle\DoctrineMigrationsBundle(),
//new Symfony\Bundle\DoctrineMongoDBBundle\DoctrineMongoDBBundle(),
//new Symfony\Bundle\PropelBundle\PropelBundle(),
//new Symfony\Bundle\TwigBundle\TwigBundle(),
// register your bundles here
// register your bundles
new Application\HelloBundle\HelloBundle(),
);
if ($this->isDebug()) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(),
}
return $bundles;

View File

@ -3,7 +3,13 @@
$loader->import('config.php');
$container->loadFromExtension('web', 'config', array(
'router' => array('resource' => '%kernel.root_dir%/config/routing_dev.php'),
'profiler' => array('only-exceptions' => false),
));
$container->loadFromExtension('webprofiler', 'config', array(
'toolbar' => true,
'intercept-redirects' => true,
));
$container->loadFromExtension('zend', 'logger', array(

View File

@ -6,8 +6,9 @@ $container->loadFromExtension('kernel', 'config', array(
'error_handler' => false,
));
$container->loadFromExtension('web', 'config', array(
$container->loadFromExtension('webprofiler', 'config', array(
'toolbar' => false,
'intercept-redirects' => false,
));
$container->loadFromExtension('zend', 'logger', array(

View File

@ -4,9 +4,9 @@ use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
$collection = new RouteCollection();
$collection->addRoute('homepage', new Route('/', array(
'_controller' => 'FrameworkBundle:Default:index',
)));
$collection->addCollection($loader->import("HelloBundle/Resources/config/routing.php"));
return $collection;

View File

@ -0,0 +1,10 @@
<?php
use Symfony\Component\Routing\RouteCollection;
$collection = new RouteCollection();
$collection->addCollection($loader->import(__DIR__.'/routing.php'));
$collection->addCollection($loader->import("WebProfilerBundle/Resources/config/routing/profiler.xml"), '/_profiler');
return $collection;

View File

@ -4,15 +4,23 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:zend="http://www.symfony-project.org/schema/dic/zend"
xmlns:web="http://www.symfony-project.org/schema/dic/symfony"
xmlns:webprofiler="http://www.symfony-project.org/schema/dic/webprofiler"
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd
http://www.symfony-project.org/schema/dic/webprofiler http://www.symfony-project.org/schema/dic/webprofiler/webprofiler-1.0.xsd
http://www.symfony-project.org/schema/dic/zend http://www.symfony-project.org/schema/dic/zend/zend-1.0.xsd">
<imports>
<import resource="config.xml" />
</imports>
<web:config
<web:config>
<web:router resource="%kernel.root_dir%/config/routing_dev.xml" />
<profiler only-exceptions="false" />
</web:config>
<webprofiler:config
toolbar="true"
intercept-redirects="true"
/>
<zend:logger

View File

@ -12,8 +12,9 @@
<import resource="config_dev.xml" />
</imports>
<web:config
<webprofiler:config
toolbar="false"
intercept-redirects="false"
/>
<kernel:config

View File

@ -7,4 +7,6 @@
<route id="homepage" pattern="/">
<default key="_controller">FrameworkBundle:Default:index</default>
</route>
<import resource="HelloBundle/Resources/config/routing.xml" />
</routes>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://www.symfony-project.org/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.symfony-project.org/schema/routing http://www.symfony-project.org/schema/routing/routing-1.0.xsd">
<import resource="routing.xml" />
<import resource="WebProfilerBundle/Resources/config/routing/profiler.xml" prefix="/_profiler" />
</routes>

View File

@ -2,7 +2,12 @@ imports:
- { resource: config.yml }
web.config:
router: { resource: "%kernel.root_dir%/config/routing_dev.yml" }
profiler: { only_exceptions: false }
webprofiler.config:
toolbar: true
intercept_redirects: true
zend.logger:
priority: debug

View File

@ -4,8 +4,9 @@ imports:
kernel.config:
error_handler: false
web.config:
webprofiler.config:
toolbar: false
intercept_redirects: false
zend.logger:
priority: debug

View File

@ -1,3 +1,6 @@
homepage:
pattern: /
defaults: { _controller: FrameworkBundle:Default:index }
hello:
resource: HelloBundle/Resources/config/routing.yml

View File

@ -0,0 +1,6 @@
_main:
resource: routing.yml
_profiler:
resource: WebProfilerBundle/Resources/config/routing/profiler.xml
prefix: /_profiler