Skip to content

Commit

Permalink
Merge branch '3.4.x' into 3.5.x
Browse files Browse the repository at this point in the history
* 3.4.x:
  Add static analysis files to .gitattributes
  [Doc] Fix a minor doc syntax issue
  Add a note that object references only work for Entities
  Add code example for purge exclusion (#389)
  • Loading branch information
derrabus committed Oct 28, 2023
2 parents 8d8fe64 + 8701605 commit 349a33f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Expand Up @@ -4,3 +4,7 @@
/Tests export-ignore
/phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpstan-baseline.neon export-ignore
/psalm.xml export-ignore
/psalm-baseline.xml export-ignore
14 changes: 11 additions & 3 deletions Resources/doc/index.rst
Expand Up @@ -152,7 +152,11 @@ Sharing Objects between Fixtures
When using multiple fixtures files, you can reuse PHP objects across different
files thanks to the **object references**. Use the ``addReference()`` method to
give a name to any object and then, use the ``getReference()`` method to get the
exact same object via its name:
exact same object via its name.

.. note::

Adding object references only works for ORM entities or ODM documents.

.. code-block:: php
Expand Down Expand Up @@ -302,7 +306,11 @@ By default all previously existing data is purged using ``DELETE FROM table`` st

If you want to exclude a set of tables from being purged, e.g. because your schema comes with pre-populated,
semi-static data, pass the option ``--purge-exclusions``. Specify ``--purge-exclusions`` multiple times to exclude
multiple tables.
multiple tables:

.. code-block:: terminal
$ php bin/console doctrine:fixtures:load --purge-exclusions=post_category --purge-exclusions=comment_type
You can also customize purging behavior significantly more and implement a custom purger plus a custom purger factory::

Expand Down Expand Up @@ -421,6 +429,6 @@ Then, enable Dependency Injection for the ``fixtures`` directory:
.. caution::

This will not override the default ``src/DataFixtures`` directory when creating fixtures with the
`Symfony MakerBundle` (``make:fixtures``).
`Symfony MakerBundle`_ (``make:fixtures``).

.. _`Symfony MakerBundle`: https://symfony.com/bundles/SymfonyMakerBundle/current/index.html

0 comments on commit 349a33f

Please sign in to comment.