Skip to content

Commit 8f338ae

Browse files
committed
[cookbook][bundles] Making tweaks per @stof
1 parent 3efe4dc commit 8f338ae

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

cookbook/bundles/extension.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,16 +436,11 @@ To take advantage of this system, you'll create a ``Configuration`` class
436436
and build a tree that defines your configuration in that class::
437437

438438
// src/Acme/HelloBundle/DependencyExtension/Configuration.php
439-
namespace Acme\HelloBundle\DependenyInjection;
439+
namespace Acme\HelloBundle\DependencyInjection;
440440

441441
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
442442
use Symfony\Component\Config\Definition\ConfigurationInterface;
443443

444-
/**
445-
* FrameworkExtension configuration structure.
446-
*
447-
* @author Jeremy Mikola <[email protected]>
448-
*/
449444
class Configuration implements ConfigurationInterface
450445
{
451446
public function getConfigTreeBuilder()
@@ -458,6 +453,8 @@ and build a tree that defines your configuration in that class::
458453
->scalarNode('my_type')->defaultValue('bar')->end()
459454
->end()
460455
;
456+
457+
return $treeBuilder;
461458
}
462459

463460
This is a *very* simple example, but you can now use this class in your ``load()``
@@ -525,5 +522,10 @@ and return a unique alias named after the bundle (e.g. ``acme_hello``). This
525522
is required because the class name doesn't follow the standards by ending
526523
in ``Extension``.
527524

525+
Additionally, the ``load()`` method of your extension will *only* be called
526+
if the user specifies the ``acme_hello`` alias in at least one configuration
527+
file. Once again, this is because the Extension class doesn't follow the
528+
standards set out above, so nothing happens automatically.
529+
528530
.. _`FrameworkBundle Configuration`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
529531
.. _`TwigBundle Configuration`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php

0 commit comments

Comments
 (0)