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
Dynamic namespace #219
Comments
+1, I have different fixtures for different environments, after upgrade I can't load specific fixtures. |
I was wondering if it's possible to add the --fixtures at the command and pass it as param to What do you think?, Sorry for my english. |
I've given this some thought - that was an oversight in the implementation that neither @weaverryan nor I thought of. Since the service container injects all services with a specific tag into the loader, there would either have to be multiple fixture loaders (meh) or have one loader that is able to distinguish different fixture sets using a tag:
You could load individual fixture sets by passing the name of the fixture set to the For those missing that functionality, would the above approach work for you? |
Hi, Same issue here... Thanks |
Have you read my comment above yours? I've made a suggestion and am waiting for feedback from people who need this feature. |
Yes, just created and injected that :
I don't know how to pass/use the fixture set "myTest" to the : |
This is a suggestion of an implementation I'd like to have feedback on before I work on the implementation. This does not work in 3.0. |
@alcaeus, if the |
It could also be named |
@alcaeus, you know what I mean. 😏 And I wouldn't call the new option |
Yea, I like the tag option. Actually, I thought this might be needed, and was thinking the same. You can even easily use the auto-registration syntax to give one specific directory a special tag (like we do with controllers). |
Any progress, @alcaeus? |
Ha, I was just about to write a reply. As Ryan pointed out, I hardly use this bundle, and the one project that uses it still works with the 2.x release line and also doesn't need to support multiple fixtures. |
I just thought @alcaeus was waiting for more feedback before starting to work on it. 😏 But I won't have time for this currently either. |
I have a similar issue that prevents migration to the new 3.0 version. I have kind of a modularised monolith and each module has it's own fixtures directory and also uses its own database. With the previous directory approach similar to the one described above I was also able to select the appropriate doctrine connection.
Now in version 3+ without the The load command allows me to pass the entity manager but then it seems to be used for all fixture services. I could pass the appropriate entity manager to the fixture services via DI but this somehow makes the object manager argument useless that is passed to the |
@bicpi would the suggestion in #219 (comment) work for you? You'd have to manually specify the entity manager, it would just reintroduce the missing I'm not sure if there should be a connection between fixtures and the EM (apart from the command), but then I've never had a use-case for multiple entity managers. |
@alcaeus I guess this should work and somehow look like this for my use case, right?
First command would load all fixture services tagged |
Or maybe setting the
defaulting to the default entity manager ? I'll try to implement this if I ever get some time... |
I was about to say that there's no guarantee everything created by that fixture should be written by that fixture, but we make the assumption already. So yeah, the
Sounds good 👍 |
It would be the reverse actually ; if set, use that em by default (otherwise use the default entity manager), and can be overridden by the option |
@Taluu Sounds correct that a CLI option always overwrites the given configuration, yes. If not set at all, the default entity manager is used. |
Ah, I understand. Yeah, makes sense as well. I don't use either, so I'll let people that have a use-case worry about this 😉 |
Does anyone have a link as to why this option was removed? I'm trying to figure out what it gains us as opposed to the detriment of not having it. |
See #219 (comment). Removing the feature was an oversight. |
Yep, we just need a PR to bring it back - is like to have it too, everyone is busy. If you want it, please add it! :) |
I have just ran into an issue, unfortunately switching back to the version where --fixtures was supported. |
I've created a PR: #250 |
I need some fixtures to initialize an empty database and some for tests for DRY. Is this issue frozen? |
@danaki This issue is open. You are welcome to submit a PR for it if you like. |
hi @alcaeus and @weaverryan, i was looking to make a pull request for this using the tags. |
The fixture loader will need to remember all the fixtures along with their tags and then handle the tags later when fixtures are loaded. |
This issue will be resolved in PR #260 |
Closing here to consolidate discussion to #260. |
what means there set "special" ? |
When this feature was implemented we renamed "set" to "group". So it will now be group="special" in the example from alcaeus. ("special" is just the name of the special group of fixtures in that example.) Read more about this feature here: |
Hi there,
i've tried to upgrade to version 3.x but i can't find a way to make it compatible with our setup. Our application has different tenants and we switch between them through an ENV variable we're setting through apache (or for cli on the shell).
Every tenant has its own bundle with its own fixtures. Before we just did something like this:
Where "${tenant}" would get replaced by ant with the value of env variable TENANT, so it would be called like this:
But since the "--fixtures" has been removed, i can't find a way to load different fixtures based on an environment variable.
The text was updated successfully, but these errors were encountered: