title: Symfony 4 changing databases on the fly
body: <p>I'm working on a blog platform, each blog has it own database.</p>
  
  <p>I need to switch database connection on the fly.</p>
  
  <p>I understand the documentation </p>
  
  <p><a href="http://symfony.com/doc/current/doctrine/multiple_entity_managers.html" rel="nofollow noreferrer">http://symfony.com/doc/current/doctrine/multiple_entity_managers.html</a></p>
  
  <p>But i would like to avoid to add everyting in the config file as there are more </p>
  
  <p>than 50 databases.</p>
  
  <p>I ve been trying to adapt this code to symfony 4 but i couldn t make it work
  <a href="https://stackoverflow.com/a/9291896/9726140">https://stackoverflow.com/a/9291896/9726140</a></p>
  
  <p>Thank you</p>