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
Afficher le fichier Open project: elgg/elgg Class Usage Examples

Protected Properties

Свойство Type Description
$cache cache for settings
$db Elgg\Database
$entities EntityTable
$table Name of the database table

Méthodes publiques

Méthode 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

Méthode 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 méthode

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 méthode

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
Résultat mixed The setting value, or null if does not exist

getAll() public méthode

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

getEntities() public méthode

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.
Résultat mixed int If count, int. If not count, array. false on errors.

remove() public méthode

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
Résultat boolean

removeAllForEntity() public méthode

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

set() public méthode

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
Résultat boolean

Property Details

$cache protected_oe property

cache for settings
protected $cache

$db protected_oe property

protected Database,Elgg $db
Résultat Elgg\Database

$entities protected_oe property

protected EntityTable,Elgg\Database $entities
Résultat EntityTable

$table protected_oe property

Name of the database table
protected $table