protected static function newConnection()
    {
        static $newDb;

        if ($newDb === null) {
            $db = static::getDb();
            $className = get_class($db);
            $newDb = new $className;

            $class = new \ReflectionClass($db);
            foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
                if (!$property->isStatic()) {
                    $name = $property->getName();
                    $newDb->$name = $db->$name;
                }
            }

            $newDb->pdo = null;
        }

        return $newDb;
    }
protected static function newConnection()
    {
        static $newDb;

        if ($newDb === null) {
            $db = static::getDb();
            $className = get_class($db);
            $newDb = new $className;

            $class = new \ReflectionClass($db);
            foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
                if (!$property->isStatic()) {
                    $name = $property->getName();
                    $newDb->$name = $db->$name;
                }
            }

            $newDb->pdo = null;
        }

        return $newDb;
    }
protected static function newConnection ( ) { static $ newDb ; if ( $ newDb === null ) { $ db = static :: getDb ( ) ; $ className = get_class ( $ db ) ; $ newDb = new $ className ; $ class = new \ ReflectionClass ( $ db ) ; foreach ( $ class -> getProperties ( \ ReflectionProperty :: IS_PUBLIC ) as $ property ) { if ( ! $ property -> isStatic ( ) ) { $ name = $ property -> getName ( ) ; $ newDb -> $ name = $ db -> $ name ; } } $ newDb -> pdo = null ; } return $ newDb ; }
Create new DB connection like the current connection

@return \yii\db\Connection
Create new DB connection like the current connection