Property | Type | Description | |
---|---|---|---|
$cache | |||
$db | |||
$entityTable | |||
$events | |||
$independents | array | ||
$session | ElggSession | ||
$table | string |
Method | Description | |
---|---|---|
__construct ( |
Constructor | |
create ( integer $entity_guid, string $name, string $value, string $value_type = '', integer $owner_guid, integer $access_id = ACCESS_PRIVATE, boolean $allow_multiple = false ) : integer | false | Create a new metadata object, or update an existing one. | |
createFromArray ( integer $entity_guid, array $name_and_values, string $value_type, integer $owner_guid, integer $access_id = ACCESS_PRIVATE, boolean $allow_multiple = false ) : boolean | This function creates metadata from an associative array of "key => value" pairs. | |
delete ( integer $id ) : boolean | Deletes metadata using its ID. | |
deleteAll ( array $options ) : boolean | null | Deletes metadata based on $options. | |
disableAll ( array $options ) : boolean | null | Disables metadata based on $options. | |
enableAll ( array $options ) : boolean | null | Enables metadata based on $options. | |
get ( integer $id ) : ElggMetadata | false | Get a specific metadata object by its id. | |
getAll ( array $options = [] ) : ElggMetadata[] | mixed | Returns metadata. Accepts all elgg_get_entities() options for entity restraints. | |
getEntities ( array $options = [] ) : ElggEntity[] | mixed | Returns entities based upon metadata. Also accepts all options available to elgg_get_entities(). Supports the singular option shortcut. | |
getEntityMetadataWhereSql ( string $e_table, string $n_table, array | null $names = null, array | null $values = null, array | null $pairs = null, string $pair_operator = 'AND', boolean $case_sensitive = true, array | null $order_by_metadata = null, array | null $owner_guids = null ) : false | array | Returns metadata name and value SQL where for entities. | |
getUrl ( integer $id ) : mixed | Get the URL for this metadata | |
handleUpdate ( string $event, string $object_type, ElggEntity $object ) : true | When an entity is updated, resets the access ID on all of its child metadata | |
isMetadataIndependent ( string $type, string $subtype ) : boolean | Determines whether entities of a given type and subtype should not change their metadata in line with their parent entity | |
registerMetadataAsIndependent ( string $type, string $subtype = '*' ) : void | Mark entities with a particular type and subtype as having access permissions that can be changed independently from their parent entity | |
update ( integer $id, string $name, string $value, string $value_type, integer $owner_guid, integer $access_id ) : boolean | Update a specific piece of metadata. |
public __construct ( |
||
$cache | A cache for this table | |
$db | The Elgg database | |
$entityTable | The entities table | |
$events | The events registry | |
$session | ElggSession | The session |
public create ( integer $entity_guid, string $name, string $value, string $value_type = '', integer $owner_guid, integer $access_id = ACCESS_PRIVATE, boolean $allow_multiple = false ) : integer | false | ||
$entity_guid | integer | The entity to attach the metadata to |
$name | string | Name of the metadata |
$value | string | Value of the metadata |
$value_type | string | 'text', 'integer', or '' for automatic detection |
$owner_guid | integer | GUID of entity that owns the metadata. Default is logged in user. |
$access_id | integer | Default is ACCESS_PRIVATE |
$allow_multiple | boolean | Allow multiple values for one key. Default is false |
return | integer | false | id of metadata or false if failure |
public createFromArray ( integer $entity_guid, array $name_and_values, string $value_type, integer $owner_guid, integer $access_id = ACCESS_PRIVATE, boolean $allow_multiple = false ) : boolean | ||
$entity_guid | integer | The entity to attach the metadata to |
$name_and_values | array | Associative array - a value can be a string, number, bool |
$value_type | string | 'text', 'integer', or '' for automatic detection |
$owner_guid | integer | GUID of entity that owns the metadata |
$access_id | integer | Default is ACCESS_PRIVATE |
$allow_multiple | boolean | Allow multiple values for one key. Default is false |
return | boolean |
public getAll ( array $options = [] ) : ElggMetadata[] | mixed | ||
$options | array | Array in format: metadata_names => null|ARR metadata names metadata_values => null|ARR metadata values metadata_ids => null|ARR metadata ids metadata_case_sensitive => BOOL Overall Case sensitive metadata_owner_guids => null|ARR guids for metadata owners metadata_created_time_lower => INT Lower limit for created time. metadata_created_time_upper => INT Upper limit for created time. metadata_calculation => STR Perform the MySQL function on the metadata values returned. The "metadata_calculation" option causes this function to return the result of performing a mathematical calculation on all metadata that match the query instead of returning \ElggMetadata objects. |
return | ElggMetadata[] | mixed |
public getEntities ( array $options = [] ) : ElggEntity[] | mixed | ||
$options | array | Array in format: metadata_names => null|ARR metadata names metadata_values => null|ARR metadata values metadata_name_value_pairs => null|ARR ( name => 'name', value => 'value', 'operand' => '=', 'case_sensitive' => true ) Currently if multiple values are sent via an array (value => array('value1', 'value2') the pair's operand will be forced to "IN". If passing "IN" as the operand and a string as the value, the value must be a properly quoted and escaped string. metadata_name_value_pairs_operator => null|STR The operator to use for combining (name = value) OPERATOR (name = value); default AND metadata_case_sensitive => BOOL Overall Case sensitive order_by_metadata => null|ARR array( 'name' => 'metadata_text1', 'direction' => ASC|DESC, 'as' => text|integer ) Also supports array('name' => 'metadata_text1') metadata_owner_guids => null|ARR guids for metadata owners |
return | ElggEntity[] | mixed | If count, int. If not count, array. false on errors. |
public getEntityMetadataWhereSql ( string $e_table, string $n_table, array | null $names = null, array | null $values = null, array | null $pairs = null, string $pair_operator = 'AND', boolean $case_sensitive = true, array | null $order_by_metadata = null, array | null $owner_guids = null ) : false | array | ||
$e_table | string | Entities table name |
$n_table | string | Normalized metastrings table name (Where entities, values, and names are joined. annotations / metadata) |
$names | array | null | Array of names |
$values | array | null | Array of values |
$pairs | array | null | Array of names / values / operands |
$pair_operator | string | ("AND" or "OR") Operator to use to join the where clauses for pairs |
$case_sensitive | boolean | Case sensitive metadata names? |
$order_by_metadata | array | null | Array of names / direction |
$owner_guids | array | null | Array of owner GUIDs |
return | false | array | False on fail, array('joins', 'wheres') |
public handleUpdate ( string $event, string $object_type, ElggEntity $object ) : true | ||
$event | string | The name of the event |
$object_type | string | The type of object |
$object | ElggEntity | The entity itself |
return | true |
public update ( integer $id, string $name, string $value, string $value_type, integer $owner_guid, integer $access_id ) : boolean | ||
$id | integer | ID of the metadata to update |
$name | string | Metadata name |
$value | string | Metadata value |
$value_type | string | Value type |
$owner_guid | integer | Owner guid |
$access_id | integer | Access ID |
return | boolean |
protected MetadataCache,Elgg\Cache $cache | ||
return |
protected EntityTable,Elgg\Database $entityTable | ||
return |