doctrine / data-fixtures

Doctrine2 ORM Data Fixtures Extensions
http://www.doctrine-project.org
MIT License
2.77k stars 224 forks source link

Feature request: Pass group (or groups) that were used to call the fixture #372

Open AntonioCS opened 2 years ago

AntonioCS commented 2 years ago

I have a fixture that I plan to use for 2 groups.

The issue is that I would like to load different data sets depending on what group was called. Currently the group is not passed to the fixture.

I believe this feature might be useful for default settings that may vary from dev to production.

So having the group name would make this simple to do.

Possible implementation:

public function load(ObjectManager $manager, ?array $groups = null) : void

It would be an empty array if no groups are passed but if there were groups it would just contain all the groups used.

Edit: Updated example code as not to be BC break ($groups defaults to null)