This bundle provides DBALManager as a Symfony service.
-
Run:
composer require jarjak/dbal-manager-bundle
-
[Symfony <4 only] Add bundle to your AppKernel.php:
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
//...
new JarJak\DBALManagerBundle\JarJakDBALManagerBundle(),
);
//...
return $bundles;
}
//...
}
You can get DBALManager as service in two ways:
$container->get('jarjak.dbal_manager');
$container->get(DBALManager::class);
For usage examples please refer to DBALManager documentation.
If you have more than one DB connection, then you can create multiple managers, one for each connection.
All you need is to pass DBAL Connection service (@secondary_connection
) to setConnection() or constructor.
secondary_dbal_manager:
class: JarJak\DBALManager
arguments:
- "@secondary_connection"