Commit Graph

780 Commits

Author SHA1 Message Date
Christophe Coevoet
857a9f3b8b [WebProfilerBundle] Fixed template to work with the new behavior of {% set %} 2011-02-19 16:54:34 +01:00
Fabien Potencier
0834bf47dc [WebProfilerBundle] removed the WDT on malformed HTML content 2011-02-19 14:41:22 +01:00
Fabien Potencier
2c45611f4e fixed WDT link to the profiler 2011-02-19 14:11:18 +01:00
Fabien Potencier
dff3585162 fixed profiler when using ESI in dev env 2011-02-19 12:18:49 +01:00
Lukas Kahwe Smith
7f182bd877 implicitly load all registered bundles, all loading is now handled by load(), disable loading of an extension explcitly via setting the extension config to false (for now only Yaml is implemented) 2011-02-15 22:11:08 +01:00
Fabien Potencier
14aa95ba21 added the concept of a main DIC extension for bundles
This allows for better conventions and better error messages if you
use the wrong configuration alias in a config file.

This is also the first step for a bigger refactoring of how the configuration
works (see next commits).

 * Bundle::registerExtensions() method has been renamed to Bundle::build()

 * The "main" DIC extension must be renamed to the new convention to be
   automatically registered:

      SensioBlogBundle -> DependencyInjection\SensioBlogExtension

 * The main DIC extension alias must follow the convention:

      sensio_blog for SensioBlogBundle

 * If you have more than one extension for a bundle (which should really
   never be the case), they must be registered manually by overriding the
   build() method

 * If you use YAML or PHP for your configuration, renamed the following
   configuration entry points in your configs:

      app -> framework
      webprofiler -> web_profiler
      doctrine_odm -> doctrine_mongo_db
2011-02-15 22:11:07 +01:00
Fabien Potencier
5c905beb13 moved common configuration classes to a new Config component 2011-02-13 22:31:50 +01:00
Fabien Potencier
b91f082be5 Revert "moved Resource to the Config component"
This reverts commit f53080860a.

Revert "[Router] config fixes"

This reverts commit 51beecc6f2.

Revert "moved duplicated files to a new Config component"

This reverts commit a8ec9b27f0.
2011-02-10 16:14:12 +01:00
Fabien Potencier
f53080860a moved Resource to the Config component 2011-02-10 16:07:42 +01:00
hidenorigoto
82a8a3fb42 [WebProfilerBundle][FrameworkBundle]Fixed events panel to handle closures correctly 2011-02-10 15:32:04 +01:00
Fabien Potencier
a8ec9b27f0 moved duplicated files to a new Config component 2011-02-10 03:43:36 +01:00
Fabien Potencier
e58a84eb09 added a FileLocator to DIC so that we can load resources like @BundleName/Resources/... 2011-02-10 00:44:02 +01:00
Fabien Potencier
e5403490e7 removed the need to define getNamespace() and getPath() in bundles 2011-02-05 22:40:30 +01:00
Fabien Potencier
f455700b88 fixed previous commit 2011-02-04 12:18:26 +01:00
Victor Berchet
3ed47114d6 [Bundle] Make getPath() less error prone by allowing both backward and forward slashes 2011-02-04 12:12:19 +01:00
Fabien Potencier
e645090423 moved security related things to a new SecurityBundle (the Security component is left unchanged) 2011-01-26 19:10:54 +01:00
Fabien Potencier
0e66e388ec added two interfaces: EventInterface and EventDispatcherInterface 2011-01-25 14:23:32 +01:00
Fabien Potencier
1c11d81611 made all event listeners lazy loaded
* The register() method on all listeners has been removed
 * Instead, the information is now put directly in the DIC tag

For instance, a listener on core.request had this method:

   public function register(EventDispatcher $dispatcher, $priority = 0)
   {
       $dispatcher->connect('core.response', array($this, 'filter'), $priority);
   }

And this tag in the DIC configuration:

  <tag name="kernel.listener" />

Now, it only has the following configuration:

  <tag name="kernel.listener" event="core.response" method="filter" priority="0" />

The event and method attributes are now mandatory.
2011-01-23 18:07:05 +01:00
Fabien Potencier
73ab687521 moved ControllerResolver methods to HttpKernel (makes more sense) 2011-01-23 10:23:33 +01:00
Johannes M. Schmitt
8d19136a55 refactors extensions to call XXXLoad only once with all config sections 2011-01-21 17:04:18 +01:00
Henrik Bjørnskov
5e9c9f4174 Template rename fix files 2011-01-21 15:06:10 +01:00
Henrik Bjørnskov
a5007febdd [FrameworkBundle] Renderer is once more the last of the templates 2011-01-21 15:06:10 +01:00
Fabien Potencier
6d1e91a1fa refactored bundle management
Before I explain the changes, let's talk about the current state.

Before this patch, the registerBundleDirs() method returned an ordered (for
resource overloading) list of namespace prefixes and the path to their
location. Here are some problems with this approach:

 * The paths set by this method and the paths configured for the autoloader
   can be disconnected (leading to unexpected behaviors);

 * A bundle outside these paths worked, but unexpected behavior can occur;

 * Choosing a bundle namespace was limited to the registered namespace
   prefixes, and their number should stay low enough (for performance reasons)
   -- moreover the current Bundle\ and Application\ top namespaces does not
   respect the standard rules for namespaces (first segment should be the
   vendor name);

 * Developers must understand the concept of "namespace prefixes" to
   understand the overloading mechanism, which is one more thing to learn,
   which is Symfony specific;

 * Each time you want to get a resource that can be overloaded (a template for
   instance), Symfony would have tried all namespace prefixes one after the
   other until if finds a matching file. But that can be computed in advance
   to reduce the overhead.

Another topic which was not really well addressed is how you can reference a
file/resource from a bundle (and take into account the possibility of
overloading). For instance, in the routing, you can import a file from a
bundle like this:

  <import resource="FrameworkBundle/Resources/config/internal.xml" />

Again, this works only because we have a limited number of possible namespace
prefixes.

This patch addresses these problems and some more.

First, the registerBundleDirs() method has been removed. It means that you are
now free to use any namespace for your bundles. No need to have specific
prefixes anymore. You are also free to store them anywhere, in as many
directories as you want. You just need to be sure that they are autoloaded
correctly.

The bundle "name" is now always the short name of the bundle class (like
FrameworkBundle or SensioCasBundle). As the best practice is to prefix the
bundle name with the vendor name, it's up to the vendor to ensure that each
bundle name is unique. I insist that a bundle name must be unique. This was
the opposite before as two bundles with the same name was how Symfony2 found
inheritance.

A new getParent() method has been added to BundleInterface. It returns the
bundle name that the bundle overrides (this is optional of course). That way,
there is no ordering problem anymore as the inheritance tree is explicitely
defined by the bundle themselves.

So, with this system, we can easily have an inheritance tree like the
following:

FooBundle < MyFooBundle < MyCustomFooBundle

MyCustomFooBundle returns MyFooBundle for the getParent() method, and
MyFooBundle returns FooBundle.

If two bundles override the same bundle, an exception is thrown.

Based on the bundle name, you can now reference any resource with this
notation:

    @FooBundle/Resources/config/routing.xml
    @FooBundle/Controller/FooController.php

This notation is the input of the Kernel::locateResource() method, which
returns the location of the file (and of course it takes into account
overloading).

So, in the routing, you can now use the following:

    <import resource="@FrameworkBundle/Resources/config/internal.xml" />

The template loading mechanism also use this method under the hood.

As a bonus, all the code that converts from internal notations to file names
(controller names: ControllerNameParser, template names: TemplateNameParser,
resource paths, ...) is now contained in several well-defined classes. The
same goes for the code that look for templates (TemplateLocator), routing
files (FileLocator), ...

As a side note, it is really easy to also support multiple-inheritance for a
bundle (for instance if a bundle returns an array of bundle names it extends).
However, this is not implemented in this patch as I'm not sure we want to
support that.

How to upgrade:

 * Each bundle must now implement two new mandatory methods: getPath() and
   getNamespace(), and optionally the getParent() method if the bundle extends
   another one. Here is a common implementation for these methods:

    /**
     * {@inheritdoc}
     */
    public function getParent()
    {
        return 'MyFrameworkBundle';
    }

    /**
     * {@inheritdoc}
     */
    public function getNamespace()
    {
        return __NAMESPACE__;
    }

    /**
     * {@inheritdoc}
     */
    public function getPath()
    {
        return strtr(__DIR__, '\\', '/');
    }

 * The registerBundleDirs() can be removed from your Kernel class;

 * If your code relies on getBundleDirs() or the kernel.bundle_dirs parameter,
   it should be upgraded to use the new interface (see Doctrine commands for
   many example of such a change);

 * When referencing a bundle, you must now always use its name (no more \ or /
   in bundle names) -- this transition was already done for most things
   before, and now applies to the routing as well;

 * Imports in routing files must be changed:
    Before: <import resource="Sensio/CasBundle/Resources/config/internal.xml" />
    After:  <import resource="@SensioCasBundle/Resources/config/internal.xml" />
2011-01-20 18:42:47 +01:00
Victor Berchet
b75840c6fc DI Extension: use the base class from the HttpKernel Component 2011-01-19 22:08:41 +01:00
Dominique Bongiraud
64fb94c725 normalized license messages in PHP files 2011-01-18 08:07:46 +01:00
Fabien Potencier
4c2537f1c3 made data collectors private 2011-01-17 11:17:48 +01:00
Fabien Potencier
d06f805d95 added a priority for data collectors 2011-01-17 11:09:31 +01:00
Fabien Potencier
a28627dfaf tweaked HTML 2011-01-17 07:42:21 +01:00
Christophe Coevoet
105d5918bc Added the roles in the Security panel of the profiler 2011-01-17 07:40:28 +01:00
Fabien Potencier
a365ab2884 changed the template name format
Before

bundle:section:template.format.renderer

After

bundle:section:template.renderer.format

Notice that both the renderer and the format are mandatory.
2011-01-15 12:33:27 +01:00
Fabien Potencier
b47cf7984b changed priority meaning to be more intuitive 2011-01-14 14:37:32 +01:00
Christophe Coevoet
1f88edd9e0 Updated routing to the new syntax 2011-01-12 07:09:19 +01:00
Victor Berchet
f2d32ccfde [Extensions] Type hints 2011-01-11 20:31:44 +01:00
Victor Berchet
40dac2363e [WebProfiler] Normalize header name and use a single reference 2011-01-11 20:30:37 +01:00
Victor Berchet
9a2e053cbc [Event] Collected data is about listener (not event) calls 2011-01-11 14:57:18 +01:00
Fabien Potencier
10fee8c8bb [HttpKernel] added escaping to the profiler SQLite storage 2011-01-08 14:29:59 +01:00
Victor Berchet
89433fbcfe [ProfilerController] Fix handling of uploaded files 2011-01-07 15:53:45 +01:00
Victor Berchet
e2f2513b05 [ProfilerController] fix view parameters 2011-01-07 15:53:02 +01:00
Victor Berchet
ae5a506532 [WebProfilerBundle] Update the notfound template (to match the default layout) 2011-01-07 15:51:08 +01:00
Victor Berchet
99b9bff684 [WebProfilerBundle] The search results must be rendered in the panel slot 2011-01-07 15:48:25 +01:00
Fabien Potencier
3022aa3e35 [WebProfilerBundle] fixed layout when templates are not defined 2011-01-07 15:48:05 +01:00
Johannes M. Schmitt
da5475ec42 service visibility changes 2011-01-05 16:01:48 +01:00
Ryan Weaver
9b10c8a866 [WebProfileBundle] Adding more information to the Response content returned when an intercept is redirected.
Since this is a debug-only feature, I think the more details we can include, the less trouble it'll cause when people are not expecting their requests to be intercepted. It's a good feature - this better-communicates what's happening.
2011-01-04 08:13:51 +01:00
Fabien Potencier
62cd09e708 [TwigBundle] replaced the asset tag with an asset function (from {% asset css/foo.css %} to {{ asset('css/foo.css') }} 2010-12-31 16:59:44 +01:00
Henrik Bjørnskov
42d2f837fe [WebProfilerBundle] Another call to block removed. 2010-12-30 13:41:10 +01:00
Fabien Potencier
0f95f75874 [WebProfilerBundle] updated templates for the latest version of Twig 2010-12-30 12:12:06 +01:00
Jordi Boggiano
98db58ac17 Minor template cleanup 2010-12-20 18:22:51 +01:00
Fabien Potencier
0518f04935 [WebProfilerBundle] removed the hide button when in the web profiler 2010-12-20 12:36:53 +01:00
Jordi Boggiano
b861c5a765 [WebProfilerBundle] Adding 'hide' button on the toolbar, fixes #9362 2010-12-20 12:31:58 +01:00
Fabien Potencier
b0cfec598e [TwigBundle] simplified code 2010-12-20 12:31:10 +01:00
Fabien Potencier
5d65f3edbd [TwigBundle] converted path and url tags to functions
{% url 'blog_post' with { 'id': post.id } %} -> {{ url('blog_post', { 'id': post.id }) }}
{% path 'blog_post' with { 'id': post.id } %} -> {{ path('blog_post', { 'id': post.id }) }}
2010-12-20 09:39:51 +01:00
Fabien Potencier
6970a46b84 updated Twig templates for the new hash syntax 2010-12-14 09:46:24 +01:00
Jordi Boggiano
c0565a5d47 [WebProfilerBundle][FrameworkBundle] Fix twig templates for compatibility with strict_variables 2010-11-26 20:24:31 +01:00
Jordi Boggiano
998d872f28 [WebProfilerBundle] Fixed var name in toolbar 2010-11-26 19:09:40 +01:00
Fabien Potencier
944d91c1df made some method name changes to have a better coherence throughout the framework
When an object has a "main" many relation with related "things" (objects,
parameters, ...), the method names are normalized:

 * get()
 * set()
 * all()
 * replace()
 * remove()
 * clear()
 * isEmpty()
 * add()
 * register()
 * count()
 * keys()

The classes below follow this method naming convention:

 * BrowserKit\CookieJar -> Cookie
 * BrowserKit\History -> Request
 * Console\Application -> Command
 * Console\Application\Helper\HelperSet -> HelperInterface
 * DependencyInjection\Container -> services
 * DependencyInjection\ContainerBuilder -> services
 * DependencyInjection\ParameterBag\ParameterBag -> parameters
 * DependencyInjection\ParameterBag\FrozenParameterBag -> parameters
 * DomCrawler\Form -> FormField
 * EventDispatcher\Event -> parameters
 * Form\FieldGroup -> Field
 * HttpFoundation\HeaderBag -> headers
 * HttpFoundation\ParameterBag -> parameters
 * HttpFoundation\Session -> attributes
 * HttpKernel\Profiler\Profiler -> DataCollectorInterface
 * Routing\RouteCollection -> Route
 * Security\Authentication\AuthenticationProviderManager -> AuthenticationProviderInterface
 * Templating\Engine -> HelperInterface
 * Translation\MessageCatalogue -> messages

The usage of these methods are only allowed when it is clear that there is a
main relation:

 * a CookieJar has many Cookies;

 * a Container has many services and many parameters (as services is the main
   relation, we use the naming convention for this relation);

 * a Console Input has many arguments and many options. There is no "main"
   relation, and so the naming convention does not apply.

For many relations where the convention does not apply, the following methods
must be used instead (where XXX is the name of the related thing):

 * get()      -> getXXX()
 * set()      -> setXXX()
 * all()      -> getXXXs()
 * replace()  -> setXXXs()
 * remove()   -> removeXXX()
 * clear()    -> clearXXX()
 * isEmpty()  -> isEmptyXXX()
 * add()      -> addXXX()
 * register() -> registerXXX()
 * count()    -> countXXX()
 * keys()
2010-11-25 17:30:06 +01:00
H. Westphal
5b056b2b9a Refactored web profiler template definitions to make it easier for bundle developers to add their templates 2010-11-23 12:48:35 +01:00
Fabien Potencier
e9d4d990df [WebProfiler] renamed block names for data collector templates 2010-11-22 08:43:30 +01:00
Fabien Potencier
381347bcfe [WebProfilerBundle] fixed data collector loading (they should always be loaded as you can enable the web profiler without the web debug toolbar) 2010-11-21 15:51:50 +01:00
H. Westphal
97d4dce614 Adds the ability to configure additional web profiler templates 2010-11-21 15:48:01 +01:00
Fabien Potencier
6fa943ad54 moved Exception and WebProfiler templates to Twig 2010-11-21 15:37:01 +01:00
henrikbjorn
c5ceb37f8b Changed bag.php and request_panel.php to dump arrays and objects as yaml. 2010-11-18 19:54:29 +01:00
Jordi Boggiano
ac0081f8b9 Switching doctypes to HTML5, it's the future 2010-11-18 07:01:03 +01:00
Fabien Potencier
4cd5b2b1ff [WebProfilerBundle] fixed redirection interceptions (we must keep as many headers as possible) 2010-11-09 22:48:02 +01:00
Fabien Potencier
4d4f9f344e added request attributes in the request data collector and web profiler 2010-11-06 16:47:49 +01:00
Fabien Potencier
52e03e8885 simplified code 2010-10-31 14:45:04 +01:00
Fabien Potencier
e1116524ed [WebProfiler] fixed WDT display 2010-10-26 17:42:44 +02:00
Fabien Potencier
f216f313e8 added the Security Component and its integration into the MVC framework
Happy birthday symfony!
2010-10-19 13:33:17 +02:00
Kris Wallsmith
f79e23ffb5 Removed all those spaces after @author that were bothering me so… 2010-10-18 16:55:41 +02:00
pborreli
2dc357d3a8 [WebProfilerBundle] Fixed label reference, fixed markup, optimized css and images 2010-10-18 16:52:47 +02:00
Masao Maeda
ade5fd6574 fixed: fixed the bug of request_panel.php in WebProfiler
When the session attributes don't exist, $data->sessionAttributes->getRawValue() cannot be called as not being defined.
So check the session attributes before calling getRawValue()
2010-10-08 15:53:41 +02:00
Bulat Shakirzyanov
db3476aeaa [WebProfilerBundle] simplified DIC extension 2010-10-06 14:31:06 +02:00
Alex
568cd57da6 [WebProfilerBundle] updated two references to the bag template to the new style by adding a .php extension to them 2010-09-30 07:17:13 +02:00
Fabien Potencier
a6dc10c31a changed templating name notation
Old notation: bundle:section:name.format:renderer (where both format and renderer are optional)
New notation: bundle:section:name.format.renderer (where only format is optional)

Valid new template names: Blog:Post:index.php, Blog:Post:index.xml.php

The new notation is more explicit and put all templating engines on the same level (there is no
more the concept of a "default" templating engine).

Even if the notation changed, the semantic has not. So, the logical template name for the above
examples is still 'index'. So, if you use a database loader for instance, the template
name is 'index' and everything else are options.

Upgrading current applications can be easily done by appending .php to each existing template
name reference (in both controllers and templates), and changing :twig to .twig for Twig templates
(for twig templates, you should also add .twig within templates themselves when referencing
another Twig templates).
2010-09-28 08:33:33 +02:00
Fabien Potencier
9e50782b9d fixed request data collector 2010-09-27 21:17:37 +02:00
Dustin Whittle
f3993b45c1 added width, height, alt tags for all images used in web profilers (for proper html) 2010-09-23 09:04:26 +02:00
Fabien Potencier
d657adbfa2 removed Symfony\Framework
Things have been moved to Symfony\Component\HttpKernel
and Symfony\Bundle\FrameworkBundle

The kernel configuration namespace was removed and merged
with the main web configuration namespace (kernel:config => web:config,
kernel:test => web:test, and kernel:session => web:session):

Before:
<kernel:config charset="UTF-8" error_handler="null" />

<web:config csrf-secret="xxxxxxxxxx">
    <web:router resource="%kernel.root_dir%/config/routing.xml" />
    <web:validation enabled="true" annotations="true" />
</web:config>

After:
<web:config csrf-secret="xxxxxxxxxx" charset="UTF-8" error-handler="null">
    <web:router resource="%kernel.root_dir%/config/routing.xml" />
    <web:validation enabled="true" annotations="true" />
</web:config>

Renamed classes:

Symfony\{Framework => Bundle\FrameworkBundle}\Cache\Cache
Symfony\{Framework => Bundle\FrameworkBundle}\Client
Symfony\{Framework => Bundle\FrameworkBundle}\Debug\EventDispatcher
Symfony\{Framework => Bundle\FrameworkBundle}\Debug\EventDispatcherTraceableInterface
Symfony\{Framework => Bundle\FrameworkBundle}\EventDispatcher
Symfony\{Framework => Component\HttpFoundation}\UniversalClassLoader
Symfony\{Framework => Component\HttpKernel}\Bundle\Bundle
Symfony\{Framework => Component\HttpKernel}\Bundle\BundleInterface
Symfony\{Framework => Component\HttpKernel}\ClassCollectionLoader
Symfony\{Framework => Component\HttpKernel}\Debug\ErrorException
Symfony\{Framework => Component\HttpKernel}\Debug\ErrorHandler
Symfony\{Bundle\FrameworkBundle => Component\HttpKernel}\Debug\ExceptionListener
Symfony\{Framework => Component\HttpKernel}\Kernel
2010-09-17 12:58:24 +02:00
Fabien Potencier
2f8db9135a fixed webprofiler on Windows (closes #9045) 2010-09-06 15:25:33 +02:00
Fabien Potencier
c8935cc25a [WebProfilerBundle] added a favicon.ico 2010-09-01 18:42:50 +02:00
Fabien Potencier
7e2f135245 simplified Profiler method names 2010-09-01 16:53:28 +02:00
Fabien Potencier
4e57899374 [WebProfilerBundle] added the bundle 2010-09-01 10:11:22 +02:00