XF 2.1 How can I use 'tablePrefix' in my addon?

inzanty

Active member
Hello everyone. I want to output the column 'tablePrefix' in config.php, to work with custom database prefix in my addon. How can i do this?

My custom database adapter:
PHP:
 public function getDb()
    {
        $config = $this->app()->get('config');
        return new \XF\Db\Mysqli\Adapter($config['sbintegration'], $config['fullUnicode']);
    }

    public function getEm($db = null)
    {
        if ($db == null)
        {
            $db = $this->getDb();
        }

        $app = $this->app();
        return new \XF\Mvc\Entity\Manager($db, $app->get('em.valueFormatter'), $app->get('extension'));
    }

Thanks in advance.
 
Back
Top Bottom