how to DI inject another database connection to component
Notice: This thread is very old.
- mcmatak
- Member | 504
how to do something like this?
in config.neon?
- App\Components\IUserControlFactory(@database.default.context)
this would not work
public function createComponentUser($name)
{
$factory = $this->getContext()->getByType(IUserControlFactory::class);
in this case the $factory will by type of Nette\Database\Context not UserControl
- David Matějka
- Moderator | 6445
-
implement: App\Components\IUserControlFactory
arguments: [@database.default.context]