PHP Class LazyRecord\ConfigLoader

schema schema.paths = [ dirpath , path, ... ] seeds = [ script path ] data_source data_source{ ds id } = { dsn => ..., user => , pass => connection_options => { ... pdo connection options }, query_options => { quote_column => true, quote_table => true, } } bootstrap = [ script path, script path ] $config->load(); $config->init(); $config->initForBuild(); // for build command.
Inheritance: implements ArrayAcces\ArrayAccess
Show file Open project: corneltek/lazyrecord Class Usage Examples

Public Properties

Property Type Description
$loaded
$symbolFilename

Protected Properties

Property Type Description
$classMap class map
$config The stashed config.

Public Methods

Method Description
addDataSource ( $dataSourceId, array $config )
buildDSNObject ( array $config ) : DSN Convert data source config to DSN object.
compile ( $sourceFile, $force = false )
getBaseCollectionClass ( )
getBaseModelClass ( )
getCacheConfig ( )
getCacheInstance ( ) we should use injection container
getClassMap ( )
getConfigStash ( )
getDataSource ( string $sourceId ) get data source by data source id.
getDataSourceIds ( )
getDataSources ( ) : array get all data sources.
getDefaultDataSource ( )
getDefaultDataSourceId ( )
getInstance ( )
getSchema ( ) : array get schema config.
getSchemaPaths ( ) : array get schema paths from config.
getSeedScripts ( )
hasAutoId ( )
init ( ) 1. inject config into data source 2. load bootstrap 3. load external schema loader.
initForBuild ( )
isLoaded ( )
load ( mixed $arg, $force = false ) Load configuration.
loadBootstrap ( ) run bootstrap code.
loadFromArray ( array $config ) Load config from array directly.
loadFromFile ( $sourceFile ) Load config from the YAML config file.
loadFromSymbol ( $force = false )
offsetExists ( $offset )
offsetGet ( $offset ) **************************** Implements interface of ArrayAccess ****************************
offsetSet ( $offset, $value )
offsetUnset ( $offset )
preprocessConfig ( array $config )
preprocessDataSourceConfig ( array $dbconfig ) This method is used for compiling config array.
removeDataSource ( $dataSourceId )
setConfigStash ( array $stash )
setDefaultDataSourceId ( $id )
setLoaded ( $loaded = true )
unload ( ) unload config and stash.
writeToSymbol ( )

Protected Methods

Method Description
loadClassMapFile ( ) load class from php source, to PHP source should return a PHP array.
loadDataSources ( ) load data sources to connection manager.
loadExternalSchemaLoader ( ) load external schema loader.

Method Details

addDataSource() public method

public addDataSource ( $dataSourceId, array $config )
$config array

buildDSNObject() public static method

Convert data source config to DSN object.
public static buildDSNObject ( array $config ) : DSN
$config array
return LazyRecord\DSN\DSN

compile() public static method

public static compile ( $sourceFile, $force = false )

getBaseCollectionClass() public method

getBaseModelClass() public method

public getBaseModelClass ( )

getCacheConfig() public method

public getCacheConfig ( )

getCacheInstance() public method

we should use injection container
public getCacheInstance ( )

getClassMap() public method

public getClassMap ( )

getConfigStash() public method

public getConfigStash ( )

getDataSource() public method

get data source by data source id.
public getDataSource ( string $sourceId )
$sourceId string

getDataSourceIds() public method

public getDataSourceIds ( )

getDataSources() public method

get all data sources.
public getDataSources ( ) : array
return array data source

getDefaultDataSource() public method

getDefaultDataSourceId() public method

getInstance() public static method

public static getInstance ( )

getSchema() public method

get schema config.
public getSchema ( ) : array
return array config

getSchemaPaths() public method

get schema paths from config.
public getSchemaPaths ( ) : array
return array paths

getSeedScripts() public method

public getSeedScripts ( )

hasAutoId() public method

public hasAutoId ( )

init() public method

1. inject config into data source 2. load bootstrap 3. load external schema loader.
public init ( )

initForBuild() public method

public initForBuild ( )

isLoaded() public method

public isLoaded ( )

load() public method

Load configuration.
public load ( mixed $arg, $force = false )
$arg mixed config file.

loadBootstrap() public method

run bootstrap code.
public loadBootstrap ( )

loadClassMapFile() protected method

load class from php source, to PHP source should return a PHP array.
protected loadClassMapFile ( )

loadDataSources() protected method

load data sources to connection manager.
protected loadDataSources ( )

loadExternalSchemaLoader() protected method

load external schema loader.
protected loadExternalSchemaLoader ( )

loadFromArray() public method

Load config from array directly.
public loadFromArray ( array $config )
$config array

loadFromFile() public method

..
public loadFromFile ( $sourceFile )

loadFromSymbol() public method

public loadFromSymbol ( $force = false )

offsetExists() public method

public offsetExists ( $offset )

offsetGet() public method

**************************** Implements interface of ArrayAccess ****************************
public offsetGet ( $offset )

offsetSet() public method

public offsetSet ( $offset, $value )

offsetUnset() public method

public offsetUnset ( $offset )

preprocessConfig() public static method

public static preprocessConfig ( array $config )
$config array

preprocessDataSourceConfig() public static method

This method is used for compiling config array.
public static preprocessDataSourceConfig ( array $dbconfig )
$dbconfig array

removeDataSource() public method

public removeDataSource ( $dataSourceId )

setConfigStash() public method

public setConfigStash ( array $stash )
$stash array

setDefaultDataSourceId() public method

public setDefaultDataSourceId ( $id )

setLoaded() public method

public setLoaded ( $loaded = true )

unload() public method

unload config and stash.
public unload ( )

writeToSymbol() public method

public writeToSymbol ( )

Property Details

$classMap protected property

class map
protected $classMap

$config protected property

The stashed config.
protected $config

$loaded public property

public $loaded

$symbolFilename public property

public $symbolFilename