Parser of config for LudoDBObject classes.

Instances of this class are created automatically by LudoDB.

package LudoDB

 Methods

Constructs new parser.

__construct(\LudoDBObject $obj, array $config) 

Parameters

$config

array

Returns true when LudoDBModel can be populated/constructed by this column.

canBePopulatedBy($column) : bool

Parameters

$column

Returns

bool

Returns true if user can read value of given column.

canReadFrom($name) : mixed

This is for the getValues and read methods of a LudoDBModel. You will get access to column values internally using $this->getValue($columnName);

Parameters

$name

Returns

mixed

Returns true if user can write to given column.

canWriteTo($name) : mixed

This is for the "save" and "setValues" methods of a LudoDBModel. You can always call $this->setValue($name, $value) internally in your LudoDBModel classes.

Parameters

$name

Returns

mixed

Return name of external class for column.

externalClassNameFor($column) : null

Parameters

$column

Returns

null

Return foreign key for a column if exists.

foreignKeyFor($column) : null

Parameters

$column

Returns

null

Return config of a column

getColumn($column) : array | null

Parameters

$column

Returns

arraynull

Return name of column by "set" or "get" method.

getColumnByMethod($methodName) : null | string

Parameters

$methodName

Returns

nullstring

Return array of columns from config.

getColumns() : array

Returns

array

Return columns to select from joined tables prefixed by their table names.

getColumnsToSelectFromJoins() : array

Returns

array

Return columns to validate

getColumnsToValidate() : array

Returns

array

Return config

getConfig() : array | null

Returns

arraynull

Return constructor params.

getConstructorParams() : array | null

Returns

arraynull

Get default data for database table.

getDefaultData() : array | null

Returns

arraynull

Return default value of a column.

getDefaultValue($column) : null

Parameters

$column

Returns

null

Return default values of all columns.

getDefaultValues() : array | null

Returns

arraynull

Return file location of this class.

getFileLocation() : string

Returns

string

Return "get" property of a column in config, i.e.

getGetMethod($column) : null | string

name of get method.

Parameters

$column

Returns

nullstring

Return name of id field.

getIdField() : string

Returns

string

Return indexed columns from config.

getIndexes() : null

Returns

null

Return internal column name, i.e.

getInternalColName($column) : mixed

key in column config. alias name will be translated to internal names.

Parameters

$column

Returns

mixed

Return array of names of joined columns prefixed by their table names.

getJoinsForSQL() : array

Returns

array

Returns ludoJS config for database columns and static columns.

getLudoJSConfig() : array

Returns

array

Return name of my columns prefixed by tableName + .

getMyColumnsForSQL() : array

Returns

array

Return orderBy property from config.

getOrderBy() : null

Returns

null

Return path to JSON file for default data (name is ClassName.data.json).

getPathToJsonConfigDefaultData() : string

Returns

string

Return public column name.

getPublicColumnName($name) : mixed

If "alias" is defined in config, that

Parameters

$name

Returns

mixed

Return "set" property of a column in config, i.e.

getSetMethod($column) : null

name of set method.

Parameters

$column

Returns

null

Return static columns

getStaticColumns() : array | null

Returns

arraynull

Return value of static column.

getStaticValue($column) : mixed

Parameters

$column

Returns

mixed

Return array of values for static columns.

getStaticValues() : array

Name of column is the key in the returned array.

Returns

array

Return table name for LudoDB

getTableName() : mixed

Returns

mixed

Return array of table names for joined columns.

getTableNamesFromJoins() : array

Returns

array

Returns references to other tables as array, example array( array('table' => 'city', 'column' => 'zip'), array('table' => 'country', 'column' => 'id') )

getTableReferences() : array

Returns

array

Return true if any columns are defined in config.

hasColumns() : bool

Returns

bool

Returns true if config has static columns.

hasStaticColumns() : bool

Returns

bool

Returns true if given column is from external LudoDBObject

isExternalColumn($name) : mixed

Parameters

$name

Returns

mixed

Returns true if auto increment of id is specified in config.

isIdAutoIncremented() : bool

Returns

bool

Returns true if given column is a static column, i.e.

isStaticColumn($column) : bool

column not defined in database which should have a static value defined in config.

Parameters

$column

Returns

bool

Return a config property by key.

getProperty($key) : null

Parameters

$key

Returns

null

Return a column property from config, example: "db", "references", "alias"

getColumnProperty($name, $property) : null

Parameters

$name

$property

Returns

null

Return config from JSON file as array.

getConfigFromFile() : array

Exceptions

\Exception

Returns

array

Return db definition of a column, example: "int auto_increment not null primary key"

getDbDefinition($column) : mixed

Parameters

$column

Returns

mixed

Return a LudoDBObject instance this LudoDBObject object extends.

getExtends() : \LudoDBObject

(Only when this class extends another LudoDBObject).

Returns

Return config property from external class referenced in config of the LudoDBObject of this class.

getExternalClassProperty($column, $property) : null

Parameters

$column

$property

Returns

null

Return column name for given set or get method from mapping cache (fast lookup).

getFromMappingCache($methodName) : null

Parameters

$methodName

Returns

null

Return array of joined tables

getJoins() : null | array

Returns

nullarray

Return LudoJS config of these columns

getLudoJSOf(array $columns) : array

Parameters

$columns

array

Returns

array

Return config of this LudoDBObject with config of parent LudoDBObject.

getMergedConfigs($config1, $config2) : array

Parameters

$config1

$config2

Returns

array

Return path to JSON config file.

getPathToJSONConfig() : string

Returns

string

Return input config validated.

getValidConfig($config) : array

Parameters

$config

Returns

array

Return true if config for given column is defined in config.

hasColumn($columnName) : bool

Parameters

$columnName

Returns

bool

Returns true if you have given access (read or write) to given column.

hasColumnAccess($name, $access) : mixed

Parameters

$name

$access

Returns

mixed

Save column alias to cache.

mapColumnAliases() 

Parse config.

parseConfig(array $config) 

Parameters

$config

array

Save mapping between set and get methods and column names in internal cache for fast lookup.

saveInMappingCache($methodName, $col) : mixed

Parameters

$methodName

$col

Returns

mixed

 Properties

 

$config : array | null
 

$aliasMapping : array
 

$columnAccessCache : array
 

$columnMappingCache : array
 

$customConstructorParams : array
 

$extensionClasses : array
 

$externalCache : array
 

$myColumns : array
 

$obj : \LudoDBObject
 

$validationColumns : array