-
-
Notifications
You must be signed in to change notification settings - Fork 329
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
Priority tag #628
Comments
Although interesting, this shouldn't be needed. For example if you consider the following scenario: [
Dummy::class => [
'dummy' => [
'title' => '@another_dummy->title'
],
'another_dummy (priority)' => [
'__construct' => [
'create' => [
'Alice',
0,
],
],
'__calls' => [
[
'setTitle' => [
'Bob'
],
],
],
],
],
], you can see here that With the current implementation, when |
Actually this might be useful for cases where dependencies are hidden from the resolver, e.g.: A:
a1:
__construct: []
__calls:
- doStuffThatHasSideEffectsOn: ['@b1']
B:
b1:
__construct: []
C:
c1:
__construct: ['@b1'] In this example, if the constructor of I faced a scenario like that and was able to make it work by:
Having flags would be a convenient way to solve this issue natively:
Also it might be useful to have a way to hydrate objets after performing method calls (e.g. when you use a constructor and method calls to create an object and need to override some property through reflection). This is not related to the issue exposed above though. What do you think? |
Would a complex way of trying to prioritize be really worth it? I'm wondering if a "simple"
I'm much less sure on how that should be approached tbh, much less how to enable it on a fixture basis. Wouldn't it be easier and more robust to create a custom factory there? |
Do you mean you would use the |
Small update: I tried to decorate Implementing |
If you have a PoC would love to have a look 👌 |
As described in #388, the fixtures are generated in the following order:
However maybe an object expects a complete object to be given during the hydration step or the method calls step. If that object is not immutable, there is no guarantee that will be the case. I think it would be nice to have a
priority
flag to allow that behaviour:The text was updated successfully, but these errors were encountered: