Skip to content

Commit f4c759a

Browse files
committed
docs: ✏️ modify the wording and configuring example
1 parent 653cd13 commit f4c759a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/index.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,21 @@ This command will generate a ``PostFactory`` class that looks like this:
181181

182182
Using ``make:factory --test`` will generate the factory in ``tests/Factory``.
183183

184-
If your entity has some properties with Doctrine relationships, the factories for the related entities must be registered
185-
in the service container so that the maker command can find them. To do that, add the following to your ``services.yaml``.
184+
.. tip::
185+
186+
When using ``--test`` flag, we're still dealing with ``dev`` environment. And because we want the container to know about our factories,
187+
we need to declare them as services even if they are in the ``tests`` directory. To do that, add the following to your configuration:
186188

187189
.. code-block:: yaml
188190
189-
# config/packages/services.yaml
191+
# config/packages/zenstruck_foundry.yaml
190192
when@dev:
191193
services:
192-
_defaults:
194+
App\Tests\Factory\:
195+
resource: '../../tests/Factory/'
193196
autowire: true
194197
autoconfigure: true
195198
196-
App\Tests\Factory\:
197-
resource: '../tests/Factory/'
198-
199199
.. tip::
200200

201201
You can globally configure which namespace the factories will be generated in:

0 commit comments

Comments
 (0)