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

Named injection for multiple database connection #2

Merged
merged 2 commits into from
Feb 23, 2017
Merged

Named injection for multiple database connection #2

merged 2 commits into from
Feb 23, 2017

Conversation

koriym
Copy link
Member

@koriym koriym commented Feb 23, 2017

For multiple database connection, 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;
}

@koriym koriym changed the title Named injection Named injection for multiple database connection Feb 23, 2017
@koriym koriym merged commit 4bd56af into 1.x Feb 23, 2017
@koriym koriym deleted the qualifier branch February 23, 2017 03:50
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

Successfully merging this pull request may close these issues.

1 participant