Phalcon\Mvc\Model\Behavior\NestedSet::getDbHandler PHP Method

getDbHandler() private method

Gets DB handler.
private getDbHandler ( Phalcon\Mvc\ModelInterface $model ) : Phalcon\Db\AdapterInterface
$model Phalcon\Mvc\ModelInterface
return Phalcon\Db\AdapterInterface
    private function getDbHandler(ModelInterface $model)
    {
        if (!$this->db instanceof AdapterInterface) {
            if ($model->getDi()->has('db')) {
                $db = $model->getDi()->getShared('db');
                if (!$db instanceof AdapterInterface) {
                    throw new Exception('The "db" service which was obtained from DI is invalid adapter.');
                }
                $this->db = $db;
            } else {
                throw new Exception('Undefined database handler.');
            }
        }
        return $this->db;
    }