protected function src($name = null)
    {
        $dataSources = Utility::get($this->reportSettings, "dataSources", array());

        if (count($dataSources) == 0) {
            throw new \Exception("There is no source available, please add at least one in the settings()");
            return false;
        }

        if (!$name) {
            $name = Utility::get(array_keys($dataSources), 0);
        }

        $dataSourceSetting = Utility::get($dataSources, $name);

        if (!$dataSourceSetting) {
            throw new \Exception("Datasource not found '$name'");
            return false;
        }
        $dataSourceClass = Utility::get(
            $dataSourceSetting,
            "class",
            '\koolreport\datasources\PdoDataSource'
        );
        $dataSourceClass = str_replace("/", "\\", $dataSourceClass);
        $dataSource = new $dataSourceClass($dataSourceSetting, $this);
        array_push($this->dataSources, $dataSource);
        return $dataSource;
    }
protected function src($name = null)
    {
        $dataSources = Utility::get($this->reportSettings, "dataSources", array());

        if (count($dataSources) == 0) {
            throw new \Exception("There is no source available, please add at least one in the settings()");
            return false;
        }

        if (!$name) {
            $name = Utility::get(array_keys($dataSources), 0);
        }

        $dataSourceSetting = Utility::get($dataSources, $name);

        if (!$dataSourceSetting) {
            throw new \Exception("Datasource not found '$name'");
            return false;
        }
        $dataSourceClass = Utility::get(
            $dataSourceSetting,
            "class",
            '\koolreport\datasources\PdoDataSource'
        );
        $dataSourceClass = str_replace("/", "\\", $dataSourceClass);
        $dataSource = new $dataSourceClass($dataSourceSetting, $this);
        array_push($this->dataSources, $dataSource);
        return $dataSource;
    }
protected function src ( $ name = null ) { $ dataSources = Utility :: get ( $ this -> reportSettings , "dataSources" , array ( ) ) ; if ( count ( $ dataSources ) == 0 ) { throw new \ Exception ( "There is no source available, please add at least one in the settings()" ) ; return false ; } if ( ! $ name ) { $ name = Utility :: get ( array_keys ( $ dataSources ) , 0 ) ; } $ dataSourceSetting = Utility :: get ( $ dataSources , $ name ) ; if ( ! $ dataSourceSetting ) { throw new \ Exception ( "Datasource not found '$name'" ) ; return false ; } $ dataSourceClass = Utility :: get ( $ dataSourceSetting , "class" , '\koolreport\datasources\PdoDataSource' ) ; $ dataSourceClass = str_replace ( "/" , "\\" , $ dataSourceClass ) ; $ dataSource = new $ dataSourceClass ( $ dataSourceSetting , $ this ) ; array_push ( $ this -> dataSources , $ dataSource ) ; return $ dataSource ; }
Get a new source

@param string $name Name of the source, if no name specified
then get the first one

@return DataSource The data source object
Get a new source