PHP Class Elgg\Database\PrivateSettingsTable

Private settings provide metadata like storage of settings for plugins and users. WARNING: API IN FLUX. DO NOT USE DIRECTLY.
Since: 2.0.0
Datei anzeigen Open project: elgg/elgg Class Usage Examples

Protected Properties

Property Type Description
$cache cache for settings
$db Elgg\Database
$entities EntityTable
$table Name of the database table

Public Methods

Method Description
__construct ( Database $db, EntityTable $entities, PluginSettingsCache $cache ) Constructor
get ( integer $entity_guid, string $name ) : mixed Gets a private setting for an entity
getAll ( integer $entity_guid ) : string[] Return an array of all private settings.
getEntities ( array $options = [] ) : mixed Returns entities based upon private settings
remove ( integer $entity_guid, string $name ) : boolean Deletes a private setting for an entity.
removeAllForEntity ( integer $entity_guid ) : boolean Deletes all private settings for an entity
set ( integer $entity_guid, string $name, string $value ) : boolean Sets a private setting for an entity.

Private Methods

Method Description
getWhereSql ( string $table, array | null $names = null, array | null $values = null, array | null $pairs = null, string $pair_operator = 'AND', string $name_prefix = '' ) : array Returns private setting name and value SQL where/join clauses for entities

Method Details

__construct() public method

Constructor
public __construct ( Database $db, EntityTable $entities, PluginSettingsCache $cache )
$db Elgg\Database The database
$entities EntityTable Entities table
$cache Elgg\Cache\PluginSettingsCache Settings cache

get() public method

Plugin authors can set private data on entities. By default private data will not be searched or exported.
public get ( integer $entity_guid, string $name ) : mixed
$entity_guid integer The entity GUID
$name string The name of the setting
return mixed The setting value, or null if does not exist

getAll() public method

Return an array of all private settings.
public getAll ( integer $entity_guid ) : string[]
$entity_guid integer The entity GUID
return string[] empty array if no settings

getEntities() public method

Also accepts all options available to elgg_get_entities(). Supports the singular option shortcut.
public getEntities ( array $options = [] ) : mixed
$options array Array in format: private_setting_names => null|ARR private setting names private_setting_values => null|ARR metadata values private_setting_name_value_pairs => null|ARR ( name => 'name', value => 'value', 'operand' => '=', ) Currently if multiple values are sent via an array (value => array('value1', 'value2') the pair's operand will be forced to "IN". private_setting_name_value_pairs_operator => null|STR The operator to use for combining (name = value) OPERATOR (name = value); default AND private_setting_name_prefix => STR A prefix to apply to all private settings. Used to namespace plugin user settings or by plugins to namespace their own settings.
return mixed int If count, int. If not count, array. false on errors.

remove() public method

Deletes a private setting for an entity.
public remove ( integer $entity_guid, string $name ) : boolean
$entity_guid integer The Entity GUID
$name string The name of the setting
return boolean

removeAllForEntity() public method

Deletes all private settings for an entity
public removeAllForEntity ( integer $entity_guid ) : boolean
$entity_guid integer The Entity GUID
return boolean

set() public method

Sets a private setting for an entity.
public set ( integer $entity_guid, string $name, string $value ) : boolean
$entity_guid integer The entity GUID
$name string The name of the setting
$value string The value of the setting
return boolean

Property Details

$cache protected_oe property

cache for settings
protected $cache

$db protected_oe property

protected Database,Elgg $db
return Elgg\Database

$entities protected_oe property

protected EntityTable,Elgg\Database $entities
return EntityTable

$table protected_oe property

Name of the database table
protected $table