Skip to content

Commit 2b3e89d

Browse files
committed
Fix bundle namespaces & pathes in code examples
1 parent 77d3dc4 commit 2b3e89d

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

bundles/configuration.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ of your bundle's configuration.
175175

176176
The ``Configuration`` class to handle the sample configuration looks like::
177177

178-
// src/Acme/SocialBundle/DependencyInjection/Configuration.php
178+
// src/DependencyInjection/Configuration.php
179179
namespace Acme\SocialBundle\DependencyInjection;
180180

181181
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
@@ -216,7 +216,7 @@ This class can now be used in your ``load()`` method to merge configurations and
216216
force validation (e.g. if an additional option was passed, an exception will be
217217
thrown)::
218218

219-
// src/Acme/SocialBundle/DependencyInjection/AcmeSocialExtension.php
219+
// src/DependencyInjection/AcmeSocialExtension.php
220220
public function load(array $configs, ContainerBuilder $container): void
221221
{
222222
$configuration = new Configuration();
@@ -236,7 +236,7 @@ For example, imagine your bundle has the following example config:
236236

237237
.. code-block:: xml
238238
239-
<!-- src/Acme/SocialBundle/Resources/config/services.xml -->
239+
<!-- src/config/services.xml -->
240240
<?xml version="1.0" encoding="UTF-8" ?>
241241
<container xmlns="http://symfony.com/schema/dic/services"
242242
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -253,8 +253,8 @@ For example, imagine your bundle has the following example config:
253253
254254
In your extension, you can load this and dynamically set its arguments::
255255

256-
// src/Acme/SocialBundle/DependencyInjection/AcmeSocialExtension.php
257-
// ...
256+
// src/DependencyInjection/AcmeSocialExtension.php
257+
namespace Acme\SocialBundle\DependencyInjection;
258258

259259
use Symfony\Component\Config\FileLocator;
260260
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
@@ -279,7 +279,7 @@ In your extension, you can load this and dynamically set its arguments::
279279
:class:`Symfony\\Component\\HttpKernel\\DependencyInjection\\ConfigurableExtension`
280280
to do this automatically for you::
281281

282-
// src/Acme/HelloBundle/DependencyInjection/AcmeHelloExtension.php
282+
// src/DependencyInjection/AcmeHelloExtension.php
283283
namespace Acme\HelloBundle\DependencyInjection;
284284

285285
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -375,6 +375,7 @@ logic to the bundle class directly::
375375
configuration definition from one or more files::
376376

377377
// src/AcmeSocialBundle.php
378+
namespace Acme\SocialBundle;
378379

379380
// ...
380381
class AcmeSocialBundle extends AbstractBundle
@@ -417,7 +418,7 @@ The ``config:dump-reference`` command dumps the default configuration of a
417418
bundle in the console using the Yaml format.
418419

419420
As long as your bundle's configuration is located in the standard location
420-
(``YourBundle\DependencyInjection\Configuration``) and does not have
421+
(``<YourBundle>/src/DependencyInjection/Configuration``) and does not have
421422
a constructor, it will work automatically. If you
422423
have something different, your ``Extension`` class must override the
423424
:method:`Extension::getConfiguration() <Symfony\\Component\\DependencyInjection\\Extension\\Extension::getConfiguration>`
@@ -451,7 +452,8 @@ URL nor does it need to exist). By default, the namespace for a bundle is
451452
``http://example.org/schema/dic/DI_ALIAS``, where ``DI_ALIAS`` is the DI alias of
452453
the extension. You might want to change this to a more professional URL::
453454

454-
// src/Acme/HelloBundle/DependencyInjection/AcmeHelloExtension.php
455+
// src/DependencyInjection/AcmeHelloExtension.php
456+
namespace Acme\HelloBundle\DependencyInjection;
455457

456458
// ...
457459
class AcmeHelloExtension extends Extension
@@ -480,10 +482,11 @@ namespace is then replaced with the XSD validation base path returned from
480482
method. This namespace is then followed by the rest of the path from the base
481483
path to the file itself.
482484

483-
By convention, the XSD file lives in the ``Resources/config/schema/``, but you
485+
By convention, the XSD file lives in the ``config/schema/``, but you
484486
can place it anywhere you like. You should return this path as the base path::
485487

486-
// src/Acme/HelloBundle/DependencyInjection/AcmeHelloExtension.php
488+
// src/DependencyInjection/AcmeHelloExtension.php
489+
namespace Acme\HelloBundle\DependencyInjection;
487490

488491
// ...
489492
class AcmeHelloExtension extends Extension
@@ -492,7 +495,7 @@ can place it anywhere you like. You should return this path as the base path::
492495

493496
public function getXsdValidationBasePath(): string
494497
{
495-
return __DIR__.'/../Resources/config/schema';
498+
return __DIR__.'/../config/schema';
496499
}
497500
}
498501

0 commit comments

Comments
 (0)