doctrine / DoctrineFixturesBundle

Symfony integration for the doctrine/data-fixtures library
MIT License
2.44k stars 201 forks source link

Dependent fixtures are not issued when attempting to call a fixture by its short name via --group #430

Closed nopenopenope closed 2 months ago

nopenopenope commented 2 months ago

Maybe its a bit related to this report here: https://github.com/doctrine/data-fixtures/issues/30

When having multiple fixtures that are dependent on each other, it might make sense to automatically issue all dependent fixtures automatically, even if only a "child of the chain" is being requested.

For example, we have following Fixtures:

AFixtures
BFixtures
CFixtures
DFixtures
... many more ...

A is dependant on B, C and D. Now, if I am going to execute this command:

php bin/console doc:fix:loa --group AFixtures

I would expect that B, C and D are going to get issued in the same manner and right order. However, that is not the case. Instead I have to specify it like so:

php bin/console doc:fix:loa --group AFixtures --group BFixtures --group CFixtures --group DFixtures

But that makes it hard to make use of the Fixtures when you have a larger set of features that you need data for. Instead, automatically execute Fixtures B, C and D would be expected (at least on my side).

Now, instead of this, I get an error:

  Fixture "App\DataFixtures\BFixtures" was declared as a dependency for fixture "App\DataFixtures\AFixtures", but it was not included in any of the loaded fixture groups.  

Especially when Fixtures have many dependencies, it is clear that you always and ever want to run all of the dependents, but probably without listing them explicitly. As you cannot run them individually without their deps.

If someone could point me to an entrypoint for it, I might be able to provide a PR for the matter.

greg0ire commented 2 months ago

Is this a duplicate of https://github.com/doctrine/DoctrineFixturesBundle/issues/371 ?

nopenopenope commented 2 months ago

Looks quite like it. :+1:

greg0ire commented 2 months ago

Great. The next minor release should fix it.

greg0ire commented 2 months ago

Duplicate of #371