Skip to content

Commit 7b4fd66

Browse files
committed
Fixed code examples in cookbook/bundles
1 parent c0e8a9a commit 7b4fd66

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

cookbook/bundles/best_practices.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ The end user can provide values in any configuration file:
263263
264264
.. code-block:: ini
265265
266+
; app/config/config.ini
266267
[parameters]
267268
acme_hello.email.from = fabien@example.com
268269

cookbook/bundles/extension.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,16 @@ Bundle class name with ``Extension``. For example, the Extension class of
103103
``AcmeHelloBundle`` would be called ``AcmeHelloExtension``::
104104

105105
// Acme/HelloBundle/DependencyInjection/AcmeHelloExtension.php
106+
namespace Acme\HelloBundle\DependencyInjection;
107+
106108
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
107109
use Symfony\Component\DependencyInjection\ContainerBuilder;
108110

109111
class AcmeHelloExtension extends Extension
110112
{
111113
public function load(array $configs, ContainerBuilder $container)
112114
{
113-
// where all of the heavy logic is done
115+
// ... where all of the heavy logic is done
114116
}
115117

116118
public function getXsdValidationBasePath()
@@ -155,8 +157,8 @@ You can begin specifying configuration under this namespace immediately:
155157
xsi:schemaLocation="http://www.example.com/symfony/schema/ http://www.example.com/symfony/schema/hello-1.0.xsd">
156158
157159
<acme_hello:config />
158-
...
159160
161+
<!-- ... -->
160162
</container>
161163
162164
.. code-block:: php
@@ -259,7 +261,7 @@ you might just merge them manually::
259261
$config = array_merge($config, $subConfig);
260262
}
261263

262-
// now use the flat $config array
264+
// ... now use the flat $config array
263265
}
264266

265267
.. caution::
@@ -289,7 +291,7 @@ configuration::
289291

290292
public function load(array $configs, ContainerBuilder $container)
291293
{
292-
// prepare your $config variable
294+
// ... prepare your $config variable
293295

294296
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
295297
$loader->load('services.xml');
@@ -301,7 +303,7 @@ option is passed and set to true::
301303

302304
public function load(array $configs, ContainerBuilder $container)
303305
{
304-
// prepare your $config variable
306+
// ... prepare your $config variable
305307

306308
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
307309
@@ -347,7 +349,7 @@ Add the following to the ``load()`` method to do this::
347349

348350
public function load(array $configs, ContainerBuilder $container)
349351
{
350-
// prepare your $config variable
352+
// ... prepare your $config variable
351353

352354
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
353355
$loader->load('services.xml');
@@ -450,9 +452,8 @@ and build a tree that defines your configuration in that class::
450452

451453
$rootNode
452454
->children()
453-
->scalarNode('my_type')->defaultValue('bar')->end()
454-
->end()
455-
;
455+
->scalarNode('my_type')->defaultValue('bar')->end()
456+
->end();
456457

457458
return $treeBuilder;
458459
}
@@ -500,6 +501,7 @@ automatically by Symfony2. If not, override the Bundle
500501
:method:`Symfony\\Component\\HttpKernel\\Bundle\\Bundle::build` method in
501502
your bundle::
502503

504+
// ...
503505
use Acme\HelloBundle\DependencyInjection\UnconventionalExtensionClass;
504506

505507
class AcmeHelloBundle extends Bundle

cookbook/bundles/inheritance.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ original method, and change its functionality::
5151
{
5252
$response = parent::registerAction();
5353
54-
// do custom stuff
54+
// ... do custom stuff
5555
5656
return $response;
5757
}

cookbook/bundles/override.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ in the core FrameworkBundle:
6363
.. code-block:: php
6464
6565
// app/config/config.php
66-
6766
$container->setParameter('translator.class', 'Acme\HelloBundle\Translation\Translator');
6867
6968
Secondly, if the class is not available as a parameter, you want to make sure the
7069
class is always overridden when your bundle is used, or you need to modify
7170
something beyond just the class name, you should use a compiler pass::
7271

73-
namespace Foo\BarBundle\DependencyInjection\Compiler;
72+
// src/Acme/FooBundle/DependencyInjection/Compiler/OverrideServiceCompilerPass.php
73+
namespace Acme\FooBundle\DependencyInjection\Compiler;
7474

7575
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7676
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -119,4 +119,4 @@ In progress...
119119
Translations
120120
------------
121121

122-
In progress...
122+
In progress...

0 commit comments

Comments
 (0)