ray / dbal-module
doctrine/dbal module for Ray.Di
Installs: 1 520
Dependents: 2
Suggesters: 0
Security: 0
Stars: 2
Watchers: 5
Forks: 1
Open Issues: 0
Requires
- doctrine/dbal: ^2.5.12
- ray/di: ^2.5.0
README
Doctrine Dbal module for Ray.Di
Installation
Composer install
$ composer require ray/dbal-module
Module install
use BEAR\DbalModule\DbalModule; use Ray\Di\AbstractModule; class AppModule extends AbstractModule { protected function configure() { $this->install(new DbalModule('driver=pdo_sqlite&memory=true'); } }
for named binding
Set qualifer
in 2nd parameter in DbalModule.
$this->install(new DbalModule('driver=pdo_sqlite&memory=true', 'log_db');
Use qualifer in @Inject
.
/** * @Inject * @Named("log_db") */ public function setLogDb(Connection $logDb) { $this->logDb = $logDb; }
DI trait
- DbalInject for
Doctrine\DBAL\Driver\Connection
interface
Demo
$ php docs/demo/run.php
// It works!