public function getAdapter($name = null)
    {
        if (null === $name) {
            $name = $this->getDefaultDatasource();
        }
        if (!isset($this->adapters[$name])) {
            if (!isset($this->adapterClasses[$name])) {
                throw new AdapterException(sprintf('No adapter class defined for datasource "%s"', $name));
            }
            $this->adapters[$name] = AdapterFactory::create($this->adapterClasses[$name]);
        }

        return $this->adapters[$name];
    }
public function getAdapter($name = null)
    {
        if (null === $name) {
            $name = $this->getDefaultDatasource();
        }
        if (!isset($this->adapters[$name])) {
            if (!isset($this->adapterClasses[$name])) {
                throw new AdapterException(sprintf('No adapter class defined for datasource "%s"', $name));
            }
            $this->adapters[$name] = AdapterFactory::create($this->adapterClasses[$name]);
        }

        return $this->adapters[$name];
    }
public function getAdapter ( $ name = null ) { if ( null === $ name ) { $ name = $ this -> getDefaultDatasource ( ) ; } if ( ! isset ( $ this -> adapters [ $ name ] ) ) { if ( ! isset ( $ this -> adapterClasses [ $ name ] ) ) { throw new AdapterException ( sprintf ( 'No adapter class defined for datasource "%s"' , $ name ) ) ; } $ this -> adapters [ $ name ] = AdapterFactory :: create ( $ this -> adapterClasses [ $ name ] ) ; } return $ this -> adapters [ $ name ] ; }
Get the adapter for a given datasource.

If the adapter does not yet exist, build it using the related adapterClass.

@param string $name The datasource name

@return AdapterInterface

@throws AdapterException
Get the adapter for a given datasource .