Prado\Security\TDbUser::getDbConnection PHP 메소드

getDbConnection() 공개 메소드

Returns a database connection that may be used to retrieve data from database.
public getDbConnection ( ) : TDbConnection
리턴 Prado\Data\TDbConnection database connection that may be used to retrieve data from database
    public function getDbConnection()
    {
        if ($this->_connection === null) {
            $userManager = $this->getManager();
            if ($userManager instanceof TDbUserManager) {
                $connection = $userManager->getDbConnection();
                if ($connection instanceof TDbConnection) {
                    $connection->setActive(true);
                    $this->_connection = $connection;
                }
            }
            if ($this->_connection === null) {
                throw new TConfigurationException('dbuser_dbconnection_invalid');
            }
        }
        return $this->_connection;
    }