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

[RFC] Configuration with user input #344

Closed
covex-nn opened this issue Apr 2, 2018 · 4 comments
Closed

[RFC] Configuration with user input #344

covex-nn opened this issue Apr 2, 2018 · 4 comments

Comments

@covex-nn
Copy link
Contributor

covex-nn commented Apr 2, 2018

Sometimes it is not posible to create a recipe without some knowledge about application. For example, Flex does not know how application stores and operates with its data. Only the developer has this knowledge! So, Flex could ask developer about application and store all answers in composer.json somewhere under extra key.

With this knowledge, Flex could replace some placeholders in configuration files or copy different files for different user input.

Examples:

  • User could choose db_driver for friendsofsymfony/user-bundle. A recipe could be created with replacing some placeholder with user choice (orm, mongodb, couchdb or custom);
  • User could choose database layer for sonata-project/media-bundle (orm, phpcr or mongodb) and copy some classes only into Entity/, Document/ or PHPCR/ directory.

What do you think?

@fabpot
Copy link
Member

fabpot commented Apr 2, 2018

I've thought about being more interactive before but I've decided early on that it would be out of the scope for Flex. Flex is all about auto-configurability, which forbids asking questions. I've seen so many projects (private ones) where installing the code means answering tens of questions you've no idea about which answers would be the best.

So, even if I like the idea, that's not something I'm wiling to consider for Flex. We still have some progress to do on being smarter, but interactivity is not on my list.

Thanks for proposing.

@slootjes
Copy link
Contributor

slootjes commented Apr 2, 2018

@covex-nn I solved this with some recipes to create a console command and in the post-install.txt I tell the user to run it. Not ideal but it does the trick.

@covex-nn
Copy link
Contributor Author

covex-nn commented Apr 2, 2018

@slootjes +1, if Flex will not be interactive, a console command (or maker for symfony/maker-bundle) is the only way for additional configuration.

@covex-nn
Copy link
Contributor Author

covex-nn commented Jul 3, 2018

@slootjes also there is an interface Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface, and if Extension implements that interface, it is possible to prepend another bundle's configuration in prepend method

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

3 participants