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
[QueryBuilder] Allow to provide an "index" of Definitions? #618
Comments
I would rather like to keep the API as small as possible ("don't make me think"). Here we would just avoid a foreach so there doesn't seem to be a lot of added value. I wonder though if $builder->addDefinitions(...$definitionsIndex); What do you think? |
Aah, yeah, variadic parameters would be a great alternative to reach the same goal, nice! |
IMO the way you store your definitions and how you collect them should be out of the container If you know you're not overriding any definition (DI\add or DI\decorate) you can just do this:
|
@juliangut note that in my example the |
Agreed. Although if the variadic things work out that is a very little impact on the API (almost invisible) and easy to maintain so that's why I think "why not". |
@holtkamp that is right, I overlooked that part, anyway that is what I don't think fits the library, checking if passed a string and if so require the file, you can easily decorate builder to do so @mnapoli just accepting a variadic list of definition arrays is a good addition, it would simplify this code to a single addDefinitions call |
Done in #627! |
Nice work @juliangut ! Thanks a bunch |
When a lot of DIC Definitions are involved, I found it was useful to organize them in separate files, which contain arrays:
Then a single "index" file can be used to refer the these separate files:
Then this "index" of Definitions can be processed like this:
Would a PR with a function that accepts such an "index" of Definitions be accepted, or is out of of scope? Something like this:
The text was updated successfully, but these errors were encountered: