public static function loadModel() { //phpActiveRecord init static::$connection = QdPhpactiverecords::getCon(); $tmp_con = static::$connection; ActiveRecord\Config::initialize(function ($cfg) use($tmp_con) { $model_dir = Qdmvc::getModel(); $cfg->set_model_directory($model_dir); $cfg->set_connections($tmp_con); # default connection is now production $cfg->set_default_connection('production'); }); }