Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an entrypoint to use a custom ReferenceRepository #386

Open
VincentLanglet opened this issue Apr 18, 2023 · 0 comments
Open

Add an entrypoint to use a custom ReferenceRepository #386

VincentLanglet opened this issue Apr 18, 2023 · 0 comments

Comments

@VincentLanglet
Copy link
Contributor

Hi !

I'd like to use a custom ReferenceRepository (https://github.com/doctrine/data-fixtures/blob/1.6.x/src/ReferenceRepository.php),

Currently:

I see two way/improvements to solve my issue:

  1. Solving Allow to inject any loader into LoadDataFixturesDoctrineCommand #380 to allow using custom fixtures loaders, then my FixtureLoader will do
$fixture = new class();
$fixture->setReferenceRepository($myCustomRepository);

AND I'll need to add a check in the AbstractExecutor (https://github.com/doctrine/data-fixtures/blob/1.6.x/src/Executor/AbstractExecutor.php#L119) to not set the ReferenceRepository if one is already set (But how do I know this since currently no method is exposed ?)

  1. Solving Have the ability to chose any executor in LoadDataFixturesDoctrineCommand #364 by allowing to use ExecutorFactories in order to use a custom executor. My factory will just do:
$executor = new ORMExecutor($em, $purger);
$executor->setReferenceRepository($myCustomRepository);

What do you think of this problem ? Any suggestion/preferred solution @greg0ire @derrabus ?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant