atlasphp / Atlas.Symfony

Symfony 4 Bundle for Atlas 3
MIT License
10 stars 3 forks source link

Miltiple database connections #2

Open grikdotnet opened 5 years ago

grikdotnet commented 5 years ago

It seems from Atlas\Symfony\DependencyInjection\Configuration and AtlasExtension classes, the connection profiles 'pdo', 'orm', 'cli' are hardcoded, a service identifier is predefined as "Atlas::class", and an injection like "public function __construct(Atlas $atlas)" is bound to the single DSN.

In the real world it is common to work with several databases. How can several instances of Atlas with different DSNs be injected?

pmjones commented 5 years ago

Hi @grikdotnet -- given https://github.com/atlasphp/Atlas.Symfony/blob/1.x/Resources/config/atlas.yaml you should be able to specify as many read and write DSNs as you like (see e.g. lines 12 and 31).

Let me know if you mean something else instead!

grikdotnet commented 5 years ago

Hello! Can I specify an exact named config, like "write1" to use for one injected instance of Alpine, and a "write2" for another? If so, where can it be specified?

Thank you!