How can I use own Database\Context class?
Notice: This thread is very old.
- Morfeo21
- Member | 35
Hi, I need to extend Nette\Database\Context
's transaction
methods.
I've written my own class which extends from Nette\Database\Context
and overrite these methods.
But I have no idea how to force Nette to use this class instead of original
Nette\Database\Context
. I've looked at Nette code and
there is:
$connection = $container->addDefinition($this->prefix("database.$name"))
->setClass('Nette\Database\Connection', array($info['dsn'], $info['user'], $info['password'], $info['options']))
->setAutowired($info['autowired'])
->addSetup('setContext', array(
new Nette\DI\Statement('Nette\Database\Context', array('@self', $reflection)),
))
->addSetup('Nette\Diagnostics\Debugger::getBlueScreen()->addPanel(?)', array(
'Nette\Database\Diagnostics\ConnectionPanel::renderException'
));
$container->addDefinition($this->prefix("database.$name.context"))
->setClass('Nette\Database\Context')
->setFactory(array($connection, 'getContext'))
->setAutowired($info['autowired']);
What means I cannot specify Context
class in config.neon?
What is the solution for this?
Thanks a lot!