Page tree
Skip to end of metadata
Go to start of metadata

Note that all these commands are isolated by module. If 'core' uses setConfig('foo', '1'), then when 'ponies' using getConfig('foo') it will return (bool) false.  If you want to access another module's data, use $this->Modulename→getConfig('foo')


	//Get Config Item
	public function getConfig($var = null, $id = "noid");
	//Set Config Item
	public function setConfig($key = null, $val = false, $id = "noid");
	//Delete Config Item
	public function delConfig($key = null, $id = "noid");
	Set multiple config items
	public function setMultiConfig($keyval = false, $id = "noid");
	//Get All config items
	public function getAll($id = "noid");
	//Get all keys
	public function getAllKeys($id = "noid");
	Get all ids
	public function getAllids();
	//Delete item by id
	public function delById($id = null);
	//Get first item by id
	public function getFirst($id = null);
	//Get last item by id
	public function getLast($id = null);


Provides

$this->getConfig($key, (optional) $id)
$this->setConfig($key, $value, (optional)$id)
$this->getAll( (optional) $id)
$this->getAllIDs()
$this->addID( (optional) $key)  // Not implemented yet
$this->getID($key)   // Not implemented yet
$this->delID($id)    // Not implemented yet

Uses

public static $dbDefaults = array ( key => value, key => value, ... );

mixed = getConfig($key, $id = "noid")

Requests a var previously stored

getConfig requests the variable stored with the key $var, and returns it.
Note that it will return an array or a StdObject if setConfig was handed an array or object, respectively.

The optional second parameter allows you to specify a sub-grouping - if you setConfig('foo', 'bar'), then getConfig('foo') == 'bar'. However,if you getConfig('foo', 1), that will return (bool) false.

setConfig($key, $val, $id = "noid")

setConfig stores $val against $key, in a format that will return it almost identically when returned by getConfig.

The optional third parameter allows you to specify a sub-grouping - if you setConfig('foo', 'bar'), then getConfig('foo') == 'bar'. However, getConfig('foo', 1) === (bool) false.

array = getAll( $id = "noid" )

Returns an associative array of all key=>value pairs referenced by $id, or if no $id is provided, all key => value pairs that weren't set with an ID.  Don't trust this to return the array in any order. If you wish to use an ordered set, use IDs and sort based on them.

arrray = getAllids()

Returns a standard array of all IDs, excluding 'noid'. Due to font ambiguity (with LL in lower case and I in upper case looking identical in some situations) this uses 'ids' in lower case.

id = addID( $key == null )

Returns a guaranteed unique ID, for storing unstructured data. May be referenced by a key. If the $key used already references an ID, this returns the ID that already exists. (The same as getID)

id = getID( $key )

Returns the id generated by $key. 
Throws Exception: If $key is null
Throws Exception: If no ID was generated with $key

 delID($id)

Deletes all key/values referenced by $id.
Throws Exception: If $key is null

 

*

  • No labels