Skip to content

Commit

Permalink
Add documentation for yaml service configuration (#393)
Browse files Browse the repository at this point in the history
* Add yaml service configuration

* Update index.rst
  • Loading branch information
freerich authored Oct 29, 2023
1 parent 6197634 commit 5988484
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions Resources/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -406,25 +406,38 @@ First, add a new ``PSR-4`` autoload-entry in the ``composer.json`` with the new
"autoload-dev": {
"psr-4": {
"...": "...",
"DataFixtures\\": "fixtures"
"DataFixtures\\": "fixtures/"
}
},
Then, enable Dependency Injection for the ``fixtures`` directory:
.. note::

.. code-block:: php
You need to dump the autoloader with ``composer dump-autoloader``

// config/services.php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
Then, enable Dependency Injection for the ``fixtures`` directory:

return function(ContainerConfigurator $container) : void {
$services = $container->services()
->defaults()
->autowire()
->autoconfigure();
.. configuration-block::

$services->load('DataFixtures\\', '../fixtures');
};
.. code-block:: yaml
# config/services.yaml
services:
DataFixtures\:
resource: '../fixtures'
.. code-block:: php
// config/services.php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return function(ContainerConfigurator $container) : void {
$services = $container->services()
->defaults()
->autowire()
->autoconfigure();
$services->load('DataFixtures\\', '../fixtures');
};
.. caution::

Expand Down

0 comments on commit 5988484

Please sign in to comment.